Review main Merged

72242[BUGFIX] Respect '_language' argument for typoLink and LinkHandler

Stefan Bürk CR +2 V +2 Normal +76 −3 updated 11/25/21, 12:39

Commit message

This patch fixes a bug where a t3 page URI with _language != 0
was resolved to a page in the default language. This caused
automatically generated redirects to translated pages to
redirect to the page in the default language.

We now use the same override handling for the '_language'
parameter (as already existed for 'L') when t3 page URIs are
resolved. Also, we ensure that both parameters are always removed
when the final URL is generated. Furthermore, this patch adds
tests to cover these cases.

Using the historical 'L' parameter still works and has been
added to be handled as language override.

Background information:

The '_language parameter' is the preferred parameter to
be used to specify the language in a t3 URI, not 'L'.

The behaviour of creating auto redirects on slug changes
was changed previously: The target was added as
LinkHandler URI (instead of the path). Along with this change,
the '_language' parameter was used to ensure the
target URL is generated in the needed language (#89327).

This introduced a problem where a redirect always redirected
to the page in default language if a t3: page URI was used with
'_language'.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Sybille Peters +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Sybille Peters +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 2128

Show 23 earlier messages
  1. Stefan Bürk uploaded patch set 1 11/20/21, 15:17

  2. core-ci voted on patch set 1 V +1 11/20/21, 15:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19591

  3. Stefan Bürk uploaded patch set 2 11/21/21, 14:42

  1. Stefan Bürk updated the commit message in patch set 3 11/21/21, 14:43

  2. Stefan Bürk uploaded patch set 4 11/21/21, 14:45

  3. core-ci voted on patch set 2 V +1 11/21/21, 14:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19603

  4. core-ci voted on patch set 3 V +1 11/21/21, 15:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19604

  5. core-ci voted on patch set 4 V +1 11/21/21, 15:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19605

  6. Stefan Bürk marked it ready for review 11/21/21, 15:10

  7. Benni Mack commented on patch set 4 11/23/21, 07:33

    PageLinkBuilder.php:172

    I would switch both if() blocks, having "_language" as a higher importance / override than the "L" parameter.
  8. Benni Mack commented on patch set 4 V +1 CR +1 11/23/21, 09:45

    PageLinkBuilder.php:172 Reply

    ah, now, that's actually correct the way it is. never mind.
  9. Oli Bartsch commented on patch set 4 11/23/21, 10:07

    TypoLinkGeneratorTest.php:227

    Could we please also have a test with both parameters set, to prove the comment "modern '_language' arguments, giving '_language' the precedence." in the code.
  10. Stefan Bürk commented on patch set 4 CR -1 11/23/21, 11:02

    Will add some more tests.

    TypoLinkGeneratorTest.php:227 Reply

    Right. Will come up with some.
  11. Stefan Bürk uploaded patch set 5 11/23/21, 11:51

  12. Stefan Bürk commented on patch set 5 11/23/21, 11:54

    PageLinkBuilder.php:172 Reply

    You are right, '_language has higher importance (as modern one), but needs that order to be so. Can we resolve this comment chain ?

    TypoLinkGeneratorTest.php:227 Reply

    Done. And thanks for pointing this out !
  13. core-ci voted on patch set 5 V +1 11/23/21, 12:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19670

  14. Oli Bartsch commented on patch set 5 V +1 CR +1 11/23/21, 12:31

    TypoLinkGeneratorTest.php:227 Reply

    Thanks for adding the tests!
  15. Sybille Peters commented on patch set 5 11/25/21, 08:50

    Can we change this commit message slightly? Is it really a regression and introduced with #89327. #89327 did introduce t3 page URI targets with _language (instead of L) in auto redirects, but wasn't that already the preferred language parameter before the patch? And page links with _language also did not work. So #89327 made a problem more severe that already existed? IMHO, the problem was that the _language parameter was introduced but not handled properly when a target URL is generated from a t3 page URI. Only the L parameter was interpreted.
    > "The 'L' argument is ignored and further not removed, resulting adding it afterwards as query parameter" I find it a little difficult to read. I would clearly separate what this patch solves, what the problem was before the patch and the additional information. Here, I think the problem that existed previously is described, not the desired behaviour, but it is not obvious from reading. Especially if present tense is used ("is"). Also, I would lead with what this patch does. One could even argue, the problem description is not part of the patch, it is part of the issue, see > Describe the fix/change introduced by the Change Request. (The problem is already described in the Forge ticket.) https://docs.typo3.org/m/typo3/guide-contributionworkflow/master/en-us/Appendix/CommitMessage.html#description-message-body (If that should not be the case, we should change that in the Contribution Guide). The code makes it quite clear. But the commit msg should be clear too. --- I hate to nitpick but I find good, descriptive commit messages very helpful and often appreciate the additional info, but it should be easy to read and understand.
  16. Sybille Peters commented on patch set 5 11/25/21, 08:52

    Reply

    This is all IMHO and not a blocker, of course.
  17. Sybille Peters commented on patch set 5 V +1 CR +1 11/25/21, 09:17

    Tested with redirects and t3 page Links with _language.
  18. Stefan Bürk updated the commit message in patch set 6 11/25/21, 09:31

  19. Stefan Bürk rebased onto patch set 7 11/25/21, 09:31

  20. core-ci voted on patch set 6 V +1 11/25/21, 09:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19722

  21. core-ci voted on patch set 7 V +1 11/25/21, 09:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/19723

  22. Oli Bartsch voted on patch set 7 V +1 CR +1 11/25/21, 10:12

  23. Sybille Peters commented on patch set 7 V +1 CR +1 11/25/21, 10:54

    Reply

    Done

    Reply

    Done
  24. Benni Mack commented on patch set 7 V +2 CR +2 11/25/21, 12:39

    PageLinkBuilder.php:172 Reply

    Ack
  25. Benni Mack merged patch set 8 11/25/21, 12:39