Review main Merged

79249[BUGFIX] Resolve page with trailing slash requested without one

Stefan Bürk CR +2 V +2 Expert +1281 −20 updated 07/04/23, 13:56

Commit message

With #89091 pages with slugs containing trailing slash have
been enabled to be resolved when requested with trailing
slash in the request uri and have been a logical follow-up
of #86055.

In between an issue with language fallback chain have been
found, which allowed that a valid translated page could be
resolved with the default language slug even and reported
as #88715 and #96010. These issues have been solved with
https://review.typo3.org/c/Packages/TYPO3.CMS/+/75101 which
partly broke the original implemented behaviour for pages
with trailing slash slugs requested without a trailing slash.

This change now ensures pages are resolved containing a trailing
slash in their "slug" like "/my-page/subpage/" if requested without
the trailing slash like "https://domain.tld/my-page/subpage".

Additionally, tests are added to cover this case along with
other possible cases. This should detect future regressions.

The docblock return annotation for `PageRouter::matchRequest()` is
changed to the correct returned value, removing ignore pattern for
the phpstan baseline instead of increasing the counter.

Note: This change ensures that a page can be resolved in any
      constellation with trailing slash in record slug/not
      in record slug and requested with trailing slash/not
      requested slug. In both cases, already working and the
      now fixed variant are serving both potential duplicate
      content - if no correct cannonical url is provided.

Tackling the duplicate issue should be done in a dedicated
change for both cases.

Used command(s):

> Build/Scripts/runTests.sh -s phpstanGenerateBaseline

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Nikita Hovratov +1
    • Benni Mack +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • Nikita Hovratov +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 5

Files 3

Review log 1521

  1. Stefan Bürk uploaded patch set 1 06/10/23, 15:26

  2. Stefan Bürk updated the commit message in patch set 2 06/10/23, 15:27

  3. Stefan Bürk updated the commit message in patch set 3 06/10/23, 15:35

  4. core-ci voted on patch set 1 V -1 06/10/23, 15:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42346

  5. core-ci voted on patch set 2 V -1 06/10/23, 15:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42347

  6. core-ci voted on patch set 3 V -1 06/10/23, 15:51 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42348

  7. Stefan Bürk uploaded patch set 4 V -1 06/10/23, 15:55

  8. core-ci voted on patch set 4 V +1 06/10/23, 16:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42350

  9. Stefan Bürk rebased onto patch set 5 V +1 06/14/23, 23:50

  10. core-ci voted on patch set 5 V +1 06/14/23, 23:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42622

  11. Oliver Klee voted on patch set 5 V +1 06/15/23, 07:10

  12. Benni Mack commented on patch set 5 06/16/23, 22:38

    PageRouter.php:203

    question: does this mean that www.example.com/my-page/ and www.example.com/my-page result in the same page/content etc (thus, creating duplicate content)?
  13. Stefan Bürk commented on patch set 5 CR -1 06/18/23, 17:01

    Putting this on the table for the next days to recheck, thus -1 for now.

    PageRouter.php:203 Reply

    Correct. Basically this is the fact already if the record slug does not contain the trailing slash. But wait ... there is a redirect then ... will recheck this. Duplicate content is not nice. Will check if in that case the other redirect may be reasonable.
  14. Stefan Bürk uploaded patch set 6 CR -1 V +1 07/03/23, 11:50

  15. Stefan Bürk commented on patch set 6 07/03/23, 11:57

    Reply

    Done

    PageRouter.php:203 Reply

    Okay, the redirect was because of auto-redirect creation. Basically there is no redirect - for the current working solution and the fixed variant with this patch. That means, that there are potential duplicate content scenarious in both cases. However, I would say let us fix this not-resolved variant and target the duplicate content issue in a dedicated change afterwards (TBH have not a solution right now for non of the two cases).
  16. core-ci voted on patch set 6 V +1 07/03/23, 11:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43222

  17. Benni Mack commented on patch set 6 V +1 CR +1 07/03/23, 12:41

    PageRouter.php:203 Reply

    Done
  18. Nikita Hovratov voted on patch set 6 V +1 CR +1 07/04/23, 13:28

  19. Oliver Klee voted on patch set 6 V +1 07/04/23, 13:51

  20. Stefan Bürk voted on patch set 6 V +2 CR +2 07/04/23, 13:56

  21. Stefan Bürk merged patch set 7 07/04/23, 13:56