Review main Abandoned

75377[BUGFIX] Allow UrlSoftReferenceParser to handle IDN

Albrecht Köhnlein CR 0 V 0 Normal +64 −1 updated 04/10/25, 07:50

Commit message

With this fix, the UrlSoftReferenceParser can handle URLs with
international domain names, that do contain non-ascii characters.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 1825

  1. Albrecht Köhnlein uploaded patch set 1 08/05/22, 20:17

  2. Stefan Bürk commented on patch set 1 08/05/22, 20:28

    UrlSoftReferenceParser.php:77

    Would it not make more sense to ue the Uri class instead of parse_url/buildUrl ? Same for method convertIdnUrlToUtf8 ?
  3. core-ci voted on patch set 1 V -1 08/05/22, 20:35 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29851

  4. Albrecht Köhnlein commented on patch set 1 08/05/22, 20:41

    My solution was directly inspired by ExternalLinktype::preprocessUrl() [1] and also ather code uses the old parse_url() [2] So I did not see any benefit from using the `Uri` class, but if anyone would recommend to migrate my code, I would not have any problems to do it. https://github.com/TYPO3/typo3/blob/09d9c87b90c8675f8049d694e2ad9c785ae06dac/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php#L347 https://github.com/TYPO3/typo3/blob/8f39c70f9859d1cb80ea54f4ec2080fecf732ffa/typo3/sysext/core/Classes/Utility/GeneralUtility.php#L823
  5. Albrecht Köhnlein commented on patch set 1 08/05/22, 20:49

    UrlSoftReferenceParser.php:77 Reply

    Sorry, I failed properly use Gerrit. You find my answer below.
  6. Albrecht Köhnlein uploaded patch set 2 08/05/22, 21:19

  7. Albrecht Köhnlein commented on patch set 2 08/05/22, 21:22

    UrlSoftReferenceParser.php:77 Reply

    I now finally decided to keep parse_url() in the code. I think, it's the easiest and best maintainable solution, because HttpUtility::buildUrl() is dedicated to generate a URL from the parse_url() return array.
  8. core-ci voted on patch set 2 V +1 08/05/22, 21:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29861

  9. Harry Glatz commented on patch set 2 V +1 08/23/22, 10:47

    > Patch Set 2: Verified+1 > > Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29861
  10. Sandra Erbel commented on patch set 2 V +1 08/23/22, 11:01

    Cherry pick it to the latest main and latest 11.5 - works for both branches (versions)
  11. Albrecht Köhnlein commented on patch set 2 08/23/22, 18:20

    Reply

    Thanks for testing :-)
  12. Stefan Bürk commented on patch set 2 CR -1 08/23/22, 18:37

    Thanks for the patch. Sadly I have to say that this patch has the one or other missassumption and thus not really working. See comments below. Will push another unit testcase to demonstrate the failing.

    UrlSoftReferenceParser.php:35 Unresolved

    `$content` is not only a url. It can and mostly is text and even text with markup around it, so calling `convertIdnUrlToAscii()` fails to convert. Will comment that below in the methods.

    UrlSoftReferenceParser.php:70 Unresolved

    $content is not only a url - so checking for examle a text with html markup and multiple links as valid url will fail, thus not calling the "splittin" (parse_url) which will also fail then. And even idn_to_ascii() do not support converting urls in a with text or markup surrounded string. See: https://3v4l.org/AJHJd

    UrlSoftReferenceParser.php:90 Unresolved

    $content is not only a url - so checking for examle a text with html markup and multiple links as valid url will fail, thus not calling the "splittin" (parse_url) which will also fail then. And even idn_to_utf8() do not support converting urls in a with text or markup surrounded string.
  13. Stefan Bürk uploaded patch set 3 08/23/22, 18:38

  14. Stefan Bürk commented on patch set 3 08/23/22, 18:42

    Reply Unresolved

    Reapplying -1 because of not working state. Having a fix for this issue is appreciated, but current solution do not work out. Maybe you or some else can comeup with another approach. Do not have one at hand right now.

    UrlSoftReferenceParser.php:77 Reply

    Done
  15. core-ci voted on patch set 3 V -1 08/23/22, 18:45 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30385

  16. Benni Mack updated the commit message in patch set 4 V -1 05/03/23, 09:22

  17. core-ci voted on patch set 4 V -1 05/03/23, 10:24 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41403

  18. Benni Mack rebased onto patch set 5 V -1 05/07/23, 21:55

  19. core-ci voted on patch set 5 V -1 05/07/23, 22:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/41643

  20. Benni Mack rebased onto patch set 6 V -1 06/11/24, 20:52

  21. core-ci voted on patch set 6 V -1 06/11/24, 20:58 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/59253

  22. Benni Mack updated the commit message in patch set 7 V -1 10/18/24, 13:32

  23. core-ci voted on patch set 7 V -1 10/18/24, 22:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67987

  24. Sybille Peters wrote 10/20/24, 09:49

    Removed cc Sybille Peters.
  25. Stefan Bürk abandoned the change 04/10/25, 07:50

    The approach of this change is wrong and should also considered in a bigger scope/concept. Not sure how to make this working out of this approach, and due to inactivity and no reaction going to close this (change) now. However, the issue is still valid.