Review main Merged

70839[TASK] Generate absolute FAL URLs in frontend

Helmut Hummel CR +2 V +2 Normal +124 −62 updated 09/13/21, 13:55

Commit message

Similar to #95027 FAL public URLs are now
automatically prefixed with absRefPrefix,
making it much easier for developers to deal
with FAL URLs, as these URLs are always "complete"
/ path absolute, after retrieving it from getPublicUrl()

With that, TYPO3 code can be simplified as well and
separate appending of absRefPrefix for FAL resources
is now removed.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Jochen Roth +1
    • Markus Klein +1
    • Benni Mack +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Jochen Roth +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 1

Files 11

Review log 3447

Show 1422 earlier messages
  1. Helmut Hummel uploaded patch set 1 08/31/21, 13:35

  2. Helmut Hummel uploaded patch set 2 08/31/21, 13:38

  3. core-ci voted on patch set 1 V -1 08/31/21, 13:39 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15936

  4. Helmut Hummel uploaded patch set 3 08/31/21, 14:32

  5. core-ci voted on patch set 3 V -1 08/31/21, 14:52 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15942

  6. Helmut Hummel uploaded patch set 4 08/31/21, 15:23

  7. core-ci voted on patch set 2 V -1 08/31/21, 15:42 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15937

  8. core-ci voted on patch set 4 V +1 08/31/21, 15:54 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15952

  9. Helmut Hummel uploaded patch set 5 08/31/21, 16:29

  10. core-ci voted on patch set 5 V +1 08/31/21, 16:44 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15958

  11. Benni Mack voted on patch set 5 V +1 CR +1 09/02/21, 18:11

  12. Benni Mack commented on patch set 5 09/02/21, 18:12

    I think this is a good change, I'm not entirely happy about the new static method in PathUtility... feels like this should rather go into HttpUtility?
  13. Benni Mack uploaded patch set 6 09/03/21, 11:44

  14. core-ci voted on patch set 6 V +1 09/03/21, 12:01 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16171

  15. Helmut Hummel commented on patch set 6 09/03/21, 12:24

    Reply

    I thought about this as well. My argument for finally ending up in putting it into PathUtility is the context of where it is used. We have GeneralUtility::isValidUrl (which indeed rather belongs to HttpUtility) to have an in depth check if the input is an URL. IMHO isValidUrl should be used when we can be sure that the input was meant to be an URL (e.g. URL input for a link or website), whereas resemblesUrl should be used for input, that can either be a a path or a fully qualified URL. Hm, now that I'm explaining it, this should rather be named like urlHasProtocolAndScheme, which in fact is what it does, and with that, HttpUtility is the place to go. 😊
  16. Helmut Hummel uploaded patch set 7 09/03/21, 14:46

  17. core-ci voted on patch set 7 V +1 09/03/21, 15:04 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16197

  18. Helmut Hummel uploaded patch set 8 09/06/21, 11:40

  19. core-ci voted on patch set 8 V +1 09/06/21, 11:55 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16317

  20. Markus Klein commented on patch set 8 09/06/21, 12:38

    HttpUtility.php:108

    That's wrong IMO. '://typo3.org/' would be a TRUE.
  21. Markus Klein commented on patch set 8 09/06/21, 12:43

    ImageService.php:85

    This is actually not needed at all anymore. We always provide absolute URLs now
  22. Markus Klein commented on patch set 8 09/06/21, 12:49

    PublicUrlPrefixer.php:30

    can we have a comment please on why this is needed?

    PublicUrlPrefixer.php:45

    not sure what the guidelines currently are, but I would prefer to have this somehow as a variable, for proper typehinting and for having TSFE as use-statement in the head
  1. Markus Klein voted on patch set 8 CR -1 09/06/21, 12:50

  2. Helmut Hummel commented on patch set 8 09/06/21, 12:57

    HttpUtility.php:108 Reply

    right. this means all strpos checks that were used previously were wrong as well. but now we have normalized the code that means the same be in exactly one place and in case we need to fix it, we can fix it in one place.

    ImageService.php:85 Reply

    true, but kept for BC and kept as it still does prefix with hostname in case absolute is set to true

    PublicUrlPrefixer.php:30 Reply

    it is there to break the recursive call, but yeah, I'm fine to add a comment why it is needed

    PublicUrlPrefixer.php:45 Reply

    I'm fine with that as well. I don't think we have guidelines for that though
  3. Markus Klein commented on patch set 8 09/06/21, 12:57

    I additionally would suggest to add some simple unit tests for the new HTTPUtility method
  4. Markus Klein commented on patch set 8 09/06/21, 13:01

    HttpUtility.php:108 Reply

    Some of them were correct, actually. ;-)

    ImageService.php:85 Reply

    Just realized, it's not obsolete. If an image is on a non-local storage, it could still some how matter (but I don't have a concrete example at hand)
  5. Helmut Hummel uploaded patch set 9 09/06/21, 13:17

  6. Helmut Hummel commented on patch set 9 09/06/21, 13:20

    HttpUtility.php:108 Reply

    Don't know what you mean with that. I changed the strpos check to be in a method and replaced the strpos checks with the method. how can some places were correct before and wrong with the moved code?
  7. core-ci voted on patch set 9 V +1 09/06/21, 13:31 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16322

  8. Markus Klein commented on patch set 9 09/06/21, 14:26

    HttpUtility.php:108 Reply

    I meant that some strpos() checks were correct (like typo3/sysext/backend/Classes/Template/ModuleTemplate.php).
  9. Markus Klein updated the commit message in patch set 10 09/06/21, 14:26

  10. core-ci voted on patch set 10 V +1 09/06/21, 14:45 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16330

  11. Helmut Hummel commented on patch set 10 09/06/21, 15:15

    HttpUtility.php:108 Reply

    got it now, thanks
  12. Markus Klein rebased onto patch set 11 09/07/21, 19:32

  13. Markus Klein uploaded patch set 12 09/07/21, 19:34

  14. Markus Klein voted on patch set 12 CR +1 09/07/21, 19:35

  15. core-ci voted on patch set 12 V -1 09/07/21, 19:43 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16392

  16. Markus Klein uploaded patch set 13 09/07/21, 19:44

  17. core-ci voted on patch set 13 V +1 09/07/21, 20:07 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16394

  18. core-ci voted on patch set 11 V -1 09/07/21, 21:40 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16390

  19. Helmut Hummel commented on patch set 13 09/11/21, 13:24

    PublicUrlPrefixer.php:30 Reply

    Done

    PublicUrlPrefixer.php:45 Reply

    Done
  20. Helmut Hummel voted on patch set 13 V +1 CR +1 09/11/21, 13:25

  21. Jochen Roth voted on patch set 13 V +1 CR +1 09/12/21, 16:07

  22. Benni Mack voted on patch set 13 V +1 CR +1 09/13/21, 06:35

  23. Helmut Hummel voted on patch set 13 V +2 CR +2 09/13/21, 13:53

  24. Helmut Hummel merged patch set 14 09/13/21, 13:53

  25. Markus Klein voted on patch set 14 CR +1 09/13/21, 13:55