diff --git a/src/PortlandLabs/Concrete5/MigrationTool/Batch/Validator/Page/Content/PageItemValidator.php b/src/PortlandLabs/Concrete5/MigrationTool/Batch/Validator/Page/Content/PageItemValidator.php index 4defd7e2..f4159fe5 100644 --- a/src/PortlandLabs/Concrete5/MigrationTool/Batch/Validator/Page/Content/PageItemValidator.php +++ b/src/PortlandLabs/Concrete5/MigrationTool/Batch/Validator/Page/Content/PageItemValidator.php @@ -15,12 +15,12 @@ public function itemExists(ItemInterface $item, Batch $batch) if (is_object($item->getContentObject())) { return true; } - + $itemPath = $this->normalizePath($item->getReference()); foreach ($batch->getPages() as $page) { - if ($page->getBatchPath() == $item->getReference()) { + if ($this->normalizePath($page->getBatchPath()) === $itemPath) { return true; } - if ($page->getOriginalPath() == $item->getReference()) { + if ($this->normalizePath($page->getOriginalPath()) === $itemPath) { return true; } } @@ -32,4 +32,9 @@ public function addMissingItemMessage(ItemInterface $item, MessageCollection $me new Message(t('Referenced page at path %s cannot be found in the site or in the current content batch.', $item->getReference()), Message::E_WARNING) ); } + + private function normalizePath(?string $path): string + { + return '/' . ltrim($path ?? '', '/'); + } }