Review main Merged

84228[BUGFIX] Enhance duplicate source detection for auto-redirect creation

Stefan Bürk CR +2 V +2 Normal +72 −8 updated 05/13/24, 20:08

Commit message

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.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Albrecht Köhnlein +1
    • Nikita Hovratov +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Georg Ringer +1
    • Albrecht Köhnlein +1
    • Nikita Hovratov +1
    • core-ci +1 CI

Issues 2

Files 4

Review log 1517

  1. Stefan Bürk uploaded patch set 1 05/13/24, 10:07

  2. core-ci voted on patch set 1 V +1 05/13/24, 10:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57603

  3. Stefan Bürk wrote 05/13/24, 11:23

    Topic set to Red
  4. Stefan Bürk wrote 05/13/24, 11:23

    Topic Red removed
  5. Stefan Bürk wrote 05/13/24, 11:23

    Topic set to Redirects
  6. Stefan Bürk updated the commit message in patch set 2 V +1 05/13/24, 11:39

  7. core-ci voted on patch set 2 V +1 05/13/24, 11:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/57615

  8. Stefan Bürk voted on patch set 2 CR -2 05/13/24, 16:22

  9. Stefan Bürk voted on patch set 2 CR 0 05/13/24, 16:33

  10. Georg Ringer voted on patch set 2 CR +1 V +1 05/13/24, 18:13

  11. Nikita Hovratov voted on patch set 2 CR +1 V +1 05/13/24, 19:06

  12. Nikita Hovratov commented on patch set 2 05/13/24, 19:08

    Just a note: It's trailing not tailing.
  13. Albrecht Köhnlein commented on patch set 2 CR -1 V -1 05/13/24, 19:13

    Feature-94499-ProvideAdditionalPageTypeSourceAuto-createRedirectSourceType.rst:127

    Unfortunatelym this only works with page suffix '/' but not with other suffixes like '.html'
  14. Albrecht Köhnlein commented on patch set 2 05/13/24, 19:17

    Feature-94499-ProvideAdditionalPageTypeSourceAuto-createRedirectSourceType.rst:127 Reply

    Sorry. I commented the wrong line, I guess.

    AddPageTypeZeroSource.php:85

    Unfortunately this only works with page suffix '/' but not with other suffixes like '.html'
  15. Albrecht Köhnlein commented on patch set 2 CR +1 V +1 05/13/24, 19:34

    AddPageTypeZeroSource.php:85 Reply

    Clarified via slack. The difference is intended.
  16. Stefan Bürk voted on patch set 2 CR +2 V +2 05/13/24, 19:46

  17. Stefan Bürk merged patch set 3 05/13/24, 20:08