[BUGFIX] Enhance duplicate source detection for auto-redirect creation
With #94499 creating redirects on page slug changes has been enhanced to determine the source based on real url building respecting available site configuration route enhancer options, for example PageTypeSuffix for page-type zero (`0`) in addition to plain slug replacement generation. This included a check to drop the `PlainSlugReplacementSource` if they match - which should be the case as long as no suffix are defined for `page-type 0`. Sadly, a default pagetype suffix is configured as slash similar to: routeEnhancers: PageTypeSuffix: type: PageType default: '/' map: '/': 0, '.json': 123 the generated slugs differs by the tailing slash - and thus creating two similar redirects instead of one, which is expected. This change modifies the duplicate detection in the corresponding `\TYPO3\CMS\Redirects\EventListener\AddPageTypeZeroSource` method `sourceEqualsPageTypeZeroSource()` to ignore tailing slashes for the comparision. A functional test is added to ensure this behaviour. Resolves: #103806 Related: #94499 Releases: main, 12.4 Change-Id: I0c07aeb8c13643cfed74de69e52a3a6fceb196cf Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84228 Reviewed-by:Stefan Bürk <stefan@buerk.tech> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Stefan Bürk <stefan@buerk.tech> Reviewed-by:
Albrecht Köhnlein <ak@koehnlein.eu> Tested-by:
core-ci <typo3@b13.com> Reviewed-by:
Nikita Hovratov <nikita.h@live.de> Tested-by:
Nikita Hovratov <nikita.h@live.de> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com> Tested-by:
Albrecht Köhnlein <ak@koehnlein.eu>
Showing
- typo3/sysext/core/Documentation/Changelog/12.3/Feature-94499-ProvideAdditionalPageTypeSourceAuto-createRedirectSourceType.rst 6 additions, 2 deletions...AdditionalPageTypeSourceAuto-createRedirectSourceType.rst
- typo3/sysext/redirects/Classes/EventListener/AddPageTypeZeroSource.php 1 addition, 1 deletion...redirects/Classes/EventListener/AddPageTypeZeroSource.php
- typo3/sysext/redirects/Tests/Functional/Service/Fixtures/SlugServiceTest_defaultSlashPageTypeSuffixCreatesOnlyPageTypeZeroSourceRedirect.csv 4 additions, 0 deletions...shPageTypeSuffixCreatesOnlyPageTypeZeroSourceRedirect.csv
- typo3/sysext/redirects/Tests/Functional/Service/SlugServiceTest.php 61 additions, 5 deletions...xt/redirects/Tests/Functional/Service/SlugServiceTest.php
Please register or sign in to comment