Skip to content

Commit

Permalink
[BUGFIX] Keep unmapped ?type parameter when using PageTypeDecorator
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Benni Mack <[email protected]>
Reviewed-by: Benni Mack <[email protected]>
  • Loading branch information
bmack committed May 10, 2021
1 parent ffad7bb commit db9b98d
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Tests/Functional/SiteHandling/EnhancerLinkGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
* The TYPO3 project - inspiring people to share!
*/

use TYPO3\CMS\Core\Configuration\SiteConfiguration;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\ApplicableConjunction;
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\AspectDeclaration;
use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Framework\Builder\Builder;
Expand Down Expand Up @@ -1177,4 +1180,33 @@ public function defaultExtbaseControllerActionNamesAreAppliedWithAdditionalNonMa

self::assertSame($expectation, (string)$response->getBody());
}

/**
* @test
*/
public function unmappedPageTypeDecoratorIsAddedAsRegularQueryParam(): void
{
$this->mergeSiteConfiguration('archive-acme-com', [
'routeEnhancers' => [
'PageType' => [
'type' => 'PageType',
'default' => '/',
'index' => '',
'map' => [
'/' => 0,
'sitemap.xml' => '1533906435'
]
]
]
]);

GeneralUtility::makeInstance(SiteConfiguration::class, $this->instancePath . '/typo3conf/sites/')->getAllExistingSites(false);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByIdentifier('archive-acme-com');
$uri = $site->getRouter()->generateUri(3000);
self::assertEquals('https://archive.acme.com/', (string)$uri);
$uri = $site->getRouter()->generateUri(3000, ['type' => '1533906435']);
self::assertEquals('https://archive.acme.com/sitemap.xml', (string)$uri);
$uri = $site->getRouter()->generateUri(3000, ['type' => '13']);
self::assertEquals('https://archive.acme.com/?type=13', (string)$uri);
}
}

0 comments on commit db9b98d

Please sign in to comment.