Review main Merged

86608[BUGFIX] Adapt AssetRenderer paths for prefixing in FE rendering

Sébastien Delcroix CR +2 V +2 Normal +46 −15 updated 05/14/25, 11:29

Commit message

In FE context, `PageRenderer` renders said « relative » paths (full path
without the leading « / ») for CSS and JS files, so the
`TyposcriptFrontendController` can then add an absolute prefix if set via
`config.absRefPrefix` or `config.forceAbsoluteUrls`.

However this was not the case for paths rendered by `AssetRenderer`
which are absolute (full path with a leading « / »).
The leading slash prevents `TyposcriptFrontendController` setting the absolute
prefix because string substitution doesn’t match.

Inspired by how `PageRenderer` doesn't resolve absolute paths for FE to
avoid conflict with `config.absRefPrefix` or `config.forceAbsoluteUrls`,
AssetRenderer now behaves the same way.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Simon Praetorius +1
  • Verified V +2 Done
    • Benni Mack +2
    • Simon Praetorius +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 3344

Show 1219 earlier messages
  1. Sébastien Delcroix uploaded patch set 1 10/15/24, 14:13

  2. core-ci voted on patch set 1 V -1 10/15/24, 14:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67842

  3. Sébastien Delcroix uploaded patch set 2 V -1 10/15/24, 16:21

  4. core-ci voted on patch set 2 V +1 10/15/24, 16:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67847

  5. Oliver Hader updated the commit message in patch set 3 V +1 10/18/24, 13:55

  6. core-ci voted on patch set 3 V +1 10/18/24, 19:37 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/68087

  7. Simon Praetorius commented on patch set 3 11/04/24, 08:49

    AssetRenderer.php:134

    I don't get why the implementation is still different from `PageRenderer->getStreamlinedFileName()` then, if it tries to cover all cases of the `PageRenderer`. If I remember this correctly, there have been multiple attempts in the past to streamline both implementations. I don't think that it's helpful to make one of the implementations still more complicated (I have a hard time grasping the different use cases and what happens afterwards with the path). Instead, there should be one well-tested implementation that covers all use cases and can be used in both places. I wouldn't want to block this if others prefer your solution, but at least I would be very careful to backport this.
  8. Sébastien Delcroix commented on patch set 3 11/05/24, 11:01

    AssetRenderer.php:134 Reply

    The other approach I wanted to test is trying to pass javascript files paths rendered by `AssetRenderer` to `PageRenderer->getStreamlinedFileName()` in order to not touch the `AssetRenderer` class (as I do in this patch). Could I provide another patch (apart from this one) to propose this alternative way ?
  9. Benni Mack commented on patch set 3 04/09/25, 18:36

    AssetRenderer.php:134 Reply

    Please feel free to push an alternative patch.
  10. Benni Mack uploaded patch set 4 V +1 04/11/25, 15:20

  11. core-ci voted on patch set 4 V -1 04/11/25, 15:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77549

  12. Benni Mack uploaded patch set 5 V -1 04/11/25, 17:00

  13. core-ci voted on patch set 5 V +1 04/11/25, 17:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77564

  14. Benni Mack commented on patch set 6 V +1 04/16/25, 06:22

    Published edit on patch set 5.
  15. core-ci voted on patch set 6 V +1 04/16/25, 06:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77801

  16. Benni Mack commented on patch set 6 CR +1 04/16/25, 06:33

    AssetRenderer.php:134 Reply

    I cleaned up other parts, so this code piece is now 1:1 the same as in PageRenderer, I think we should go with this one.
  17. Simon Praetorius voted on patch set 6 CR +1 04/16/25, 07:40

  18. Benni Mack updated the commit message in patch set 7 CR +1 V +1 04/16/25, 10:32

  19. core-ci voted on patch set 7 V +1 04/16/25, 10:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/77826

  1. Achim Fritz voted on patch set 7 CR +1 V +1 04/22/25, 08:37

  2. Achim Fritz commented on patch set 7 04/22/25, 08:42

    AssetRenderer.php:143

    should return bool (else condition isFrontend()) is always true ...
  3. Benni Mack uploaded patch set 8 CR +1 V +1 04/22/25, 08:43

  4. Benni Mack commented on patch set 8 04/22/25, 08:48

    AssetRenderer.php:143 Reply

    Done
  5. core-ci voted on patch set 8 V -1 04/22/25, 08:55 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78017

  6. Benni Mack uploaded patch set 9 V -1 04/22/25, 11:51

  7. core-ci voted on patch set 9 V +1 04/22/25, 11:57 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78028

  8. Benni Mack voted on patch set 9 CR +1 V +1 04/22/25, 12:12

  9. Simon Praetorius commented on patch set 9 04/22/25, 13:49

    Is the backport to 12.4 intended? If that's the case, I could test this with my vite extension (which skips this whole code, but only since v13).
  10. Benni Mack commented on patch set 9 04/22/25, 14:26

    Reply

    yes
  11. Simon Praetorius commented on patch set 9 04/22/25, 15:37

    First feedback: For my concrete project, before this patch the assets have the cache-busting timestamp, after this patch it's gone. So I'm not sure if this works as expected. Will look into it further in the next days.
  12. Sébastien Delcroix commented on patch set 9 04/22/25, 16:26

    Reply

    First feedback for me as well on TYPO3v12 : config.forceAbsoluteUrls = 1 and config.absRefPrefix = https://example.org/ are working with f:asset.css and f:asset.script. I also have cache-busting timestamps for both of them as you can see: - https://t3c-v12.ddev.site/typo3conf/ext/styleguide/Resources/Public/Css/frontend.css?1725639203"; - https://t3c-v12.ddev.site/typo3conf/ext/styleguide/Resources/Public/JavaScript/prism.js?1725639203 I've tested by modifying the StyleguideFrontend Fluid template.
  13. Sébastien Delcroix commented on patch set 9 04/22/25, 16:30

    Reply

    While testing, I've identified another similar issue, with f:uri.resource ViewHelper this time. {f:uri.resource(path:'EXT:styleguide/Resources/Public/Css/frontend.css', extensionName: 'styleguide')} generates absolute paths but without the absRefPrefix nor the domain.
  14. Benni Mack commented on patch set 9 04/22/25, 17:15

    Reply

  15. Simon Praetorius commented on patch set 9 04/23/25, 15:03

    Reply

    After looking into my issue a bit more, I would be hesitant to backport this to v12 since previous changes in v13 already introduced regressions. See https://review.typo3.org/c/Packages/TYPO3.CMS/+/89200
  16. Benni Mack updated the commit message in patch set 10 CR +1 V +1 04/24/25, 10:09

  17. core-ci voted on patch set 10 V +1 04/24/25, 10:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78109

  18. Benni Mack rebased onto patch set 11 V +1 04/24/25, 10:59

  19. core-ci voted on patch set 11 V +1 04/24/25, 11:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78114

  20. Benni Mack voted on patch set 11 CR +1 V +1 04/24/25, 11:08

  21. Simon Praetorius voted on patch set 11 CR +1 V +1 04/24/25, 11:16

  22. Benni Mack commented on patch set 11 CR +2 V +2 04/24/25, 11:17

    Reply

    Done
  23. Benni Mack merged patch set 12 04/24/25, 12:07

  24. Garvin Hicking commented on patch set 12 05/13/25, 11:42

  25. Benni Mack wrote 05/14/25, 11:29

    Created a revert of this change as I36ff58f3737ef42dbb2e65d0f9fcfa374bbdefef