Skip to content
Snippets Groups Projects
Commit 62598777 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[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: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarAlbrecht Köhnlein <ak@koehnlein.eu>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: default avatarAlbrecht Köhnlein <ak@koehnlein.eu>
parent 2566f552
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment