diff --git a/lib/Service/PageService.php b/lib/Service/PageService.php index 2f5da770c..2b4360086 100644 --- a/lib/Service/PageService.php +++ b/lib/Service/PageService.php @@ -1024,7 +1024,7 @@ public function delete(int $collectiveId, int $id, string $userId): void { public function getPageLink(string $collectiveName, PageInfo $pageInfo, bool $withFileId = true): string { $collectiveRoute = rawurlencode($collectiveName); $pagePathRoute = implode('/', array_map('rawurlencode', explode('/', $pageInfo->getFilePath()))); - $pageTitleRoute = rawurlencode($pageInfo->getTitle()); + $pageTitleRoute = ($pageInfo->getFileName() === PageInfo::INDEX_PAGE_TITLE . PageInfo::SUFFIX) ? '' : rawurlencode($pageInfo->getTitle()); $fullRoute = implode('/', array_filter([ $collectiveRoute, $pagePathRoute, diff --git a/tests/Unit/Service/PageServiceTest.php b/tests/Unit/Service/PageServiceTest.php index 6b6b39d83..e71caf5b9 100644 --- a/tests/Unit/Service/PageServiceTest.php +++ b/tests/Unit/Service/PageServiceTest.php @@ -253,6 +253,7 @@ public function testGetPagesFromFolder(): void { public function testGetPageLink(): void { $collectiveName = 'My Collective'; + $pageInfo1 = new PageInfo(); $pageInfo1->setId(123); $pageInfo1->setFilePath('page one'); @@ -264,7 +265,7 @@ public function testGetPageLink(): void { $pageInfo2 = new PageInfo(); $pageInfo2->setId(124); - $pageInfo2->setFilePath('page two/with another layer/and#spec!al_ch@rs?;'); + $pageInfo2->setFilePath('page two/with another layer/and#spec!al_ch@rs?;/page'); $pageInfo2->setFileName('Readme.md'); $pageInfo2->setTitle('page');