Review main Merged

71889[BUGFIX] Ensure regexp capture group works with relative target

Stefan Bürk CR +2 V +2 Normal +133 −3 updated 10/29/21, 08:10

Commit message

RedirectService has been using LinkHandler to retrieve
the targeturl, thus supporting all TYPO3 has to offer,
like t3:// support, but also the legacy types for link
fields.

This had the effect, that for regexp redirects with
capture group replacement, this has not been executed,
this leading to incorrect redirects.

This patch assumes for undetermined urls for redirect
targets starting with an '/', that they are meant as
relative target redirects on the current request host.

This patch returns link details as type 'url' with the
relative path in the resolving method for redirects,
thus returning correct relative redirects but ensures
that regexp capture group replacements are done.

Redirects target without a leading slash could not
be handled in the same way, as they are assumed and
resolved as page links with the target as pageid.
These cannot be safely changed. Further tests are
added to cover these cases.

Relative redirects are executed relatively, without
adding a domain and scheme.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Guido Schmechel +1
    • Sybille Peters +1
    • Mathias Brodala +1
  • Verified V +2 Done
    • Benni Mack +2
    • Guido Schmechel +1
    • Sybille Peters +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 2737

Show 712 earlier messages
  1. Stefan Bürk uploaded patch set 1 10/19/21, 15:28

  2. Stefan Bürk updated the commit message in patch set 2 10/19/21, 15:43

  3. core-ci voted on patch set 1 V +1 10/19/21, 15:49 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18326

  4. core-ci voted on patch set 2 V +1 10/19/21, 15:57 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18328

  5. Sybille Peters voted on patch set 2 V +1 10/19/21, 20:19

  6. Stefan Bürk uploaded patch set 3 10/22/21, 16:54

  7. Stefan Bürk updated the commit message in patch set 4 10/22/21, 16:54

  8. core-ci voted on patch set 4 V +1 10/22/21, 17:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18428

  9. core-ci voted on patch set 3 V +1 10/22/21, 17:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18427

  10. Sybille Peters voted on patch set 4 V +1 10/22/21, 17:17

  11. Stefan Bürk uploaded patch set 5 10/22/21, 17:35

  12. core-ci voted on patch set 5 V +1 10/22/21, 17:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18429

  1. Guido Schmechel updated the commit message in patch set 6 10/23/21, 14:36

  2. core-ci voted on patch set 6 V +1 10/23/21, 14:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18443

  3. Sybille Peters rebased onto patch set 7 10/23/21, 16:30

  4. Sybille Peters commented on patch set 7 V -1 10/23/21, 16:34

    Stefan, I have pushed a patch with a test which fails - even with this patch. I tested the patch before and it fixes the aforementioned problem. I don't know if my new test is in the scope of this patch and I am not sure if I made the correct assumptions. Please check and disregard if it does not apply. The problem is if we refer to a capture group in the query parameter of a t3 link. t3://page?uid=$1
  5. Stefan Bürk commented on patch set 7 10/23/21, 16:47

    Reply

    Sry, which tests did you pushed ? Maybe I'm blind, cannot see a pushed test from you. I even cannot see that "fail" you mentioned, if you pushed it. Or do you man as a independet gerrit patch ? Anyway, this patch is about ensure capture group replacement works for human entered relative targets. Regarding the t3:// link, I would like to handle that seperatly, and thinking about it seperatly. Could you agree with handling that seperatly, in another issue/patch ?
  6. core-ci voted on patch set 7 V +1 10/23/21, 16:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18449

  7. Sybille Peters uploaded patch set 8 10/23/21, 16:51

  8. Sybille Peters commented on patch set 8 10/23/21, 16:52

    Reply

    oops. Is uploaded.
  9. core-ci voted on patch set 8 V -1 10/23/21, 17:06 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18450

  10. Stefan Bürk commented on patch set 8 10/23/21, 18:13

    Yeah, but as I said - can we leave the t3:// thing for another patch ? Would suggest to go back to patchset 8 (reverting the tests) and handle that inanother patch, as this is not so trival as it sounds. Anway this patch should only handle the regexp capture group replacement for manual entered relative targets. Do you confirm ?
  11. Sybille Peters commented on patch set 8 10/23/21, 18:42

    Reply

    ok. I will push 7 again.
  12. Sybille Peters uploaded patch set 9 10/23/21, 18:43

  13. Sybille Peters voted on patch set 9 V +1 CR +1 10/23/21, 18:46

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

  15. Guido Schmechel voted on patch set 9 CR +1 10/24/21, 10:07

  16. Mathias Brodala commented on patch set 9 CR -1 10/28/21, 08:30

    RedirectService.php:207

    This should be "LinkService::TYPE_URL" for clarity.
  17. Stefan Bürk commented on patch set 10 10/28/21, 08:50

    Published edit on patch set 9.
  18. Stefan Bürk commented on patch set 10 10/28/21, 08:50

    RedirectService.php:207 Reply

    Ack
  19. Mathias Brodala commented on patch set 10 CR +1 10/28/21, 08:55

    I totally love how much you have trimmed this down!
  20. core-ci voted on patch set 10 V +1 10/28/21, 09:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/18643

  21. Benni Mack voted on patch set 10 V +1 CR +1 10/28/21, 12:22

  22. Sybille Peters commented on patch set 10 V +1 CR +1 10/28/21, 15:47

    Use case with capturing regex and target path (/path/$1) working fine. better working functionality and less code - nice 😊
  23. Guido Schmechel voted on patch set 10 V +1 CR +1 10/28/21, 22:30

  24. Benni Mack voted on patch set 10 V +2 CR +2 10/29/21, 08:10

  25. Benni Mack merged patch set 11 10/29/21, 08:10