Skip to content

Commit db9b98d

Browse files
committed
[BUGFIX] Keep unmapped ?type parameter when using PageTypeDecorator
This change keeps the type parameter (e.g. ?type=13) even if PageTypeDecorator is used when building URLs but "13" is not part of the map in the site configuration. A test is added in order to make sure this functionality will not break (again), see https://review.typo3.org/c/Packages/TYPO3.CMS/+/62383 for the original fix without tests. Resolves: #87104 Related: #87817 Related: #88836 Releases: master, 10.4, 9.5 Change-Id: Ic7f82bfa9f28f971162e1af1b557188f61446462 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69116 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org>
1 parent ffad7bb commit db9b98d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Tests/Functional/SiteHandling/EnhancerLinkGeneratorTest.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
* The TYPO3 project - inspiring people to share!
1616
*/
1717

18+
use TYPO3\CMS\Core\Configuration\SiteConfiguration;
1819
use TYPO3\CMS\Core\Core\Bootstrap;
20+
use TYPO3\CMS\Core\Site\SiteFinder;
21+
use TYPO3\CMS\Core\Utility\GeneralUtility;
1922
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\ApplicableConjunction;
2023
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\AspectDeclaration;
2124
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder;
@@ -1177,4 +1180,33 @@ public function defaultExtbaseControllerActionNamesAreAppliedWithAdditionalNonMa
11771180

11781181
self::assertSame($expectation, (string)$response->getBody());
11791182
}
1183+
1184+
/**
1185+
* @test
1186+
*/
1187+
public function unmappedPageTypeDecoratorIsAddedAsRegularQueryParam(): void
1188+
{
1189+
$this->mergeSiteConfiguration('archive-acme-com', [
1190+
'routeEnhancers' => [
1191+
'PageType' => [
1192+
'type' => 'PageType',
1193+
'default' => '/',
1194+
'index' => '',
1195+
'map' => [
1196+
'/' => 0,
1197+
'sitemap.xml' => '1533906435'
1198+
]
1199+
]
1200+
]
1201+
]);
1202+
1203+
GeneralUtility::makeInstance(SiteConfiguration::class, $this->instancePath . '/typo3conf/sites/')->getAllExistingSites(false);
1204+
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('archive-acme-com');
1205+
$uri = $site->getRouter()->generateUri(3000);
1206+
self::assertEquals('https://archive.acme.com/', (string)$uri);
1207+
$uri = $site->getRouter()->generateUri(3000, ['type' => '1533906435']);
1208+
self::assertEquals('https://archive.acme.com/sitemap.xml', (string)$uri);
1209+
$uri = $site->getRouter()->generateUri(3000, ['type' => '13']);
1210+
self::assertEquals('https://archive.acme.com/?type=13', (string)$uri);
1211+
}
11801212
}

0 commit comments

Comments
 (0)