Review main Merged

83043[BUGFIX] Fix ResourceFactory EXT: resolution in subfolder & composer-mode

Ayke Halder CR +2 V +2 Easy +3 −1 updated 10/07/24, 08:30

Commit message

Using `<f:image src="EXT:example/Resources/Public/Images/test.svg" />`
to include an image in a symlinked composer mode installation failed
with:
    'Unable to render image tag in "pages:123": File
     /symlink/_assets/abcdef0[…]/Images/test.svg does not exist.'

The file exists and is directly accessible via:
https://example.org/symlink/_assets/abcdef0[…]/Images/test.svg

Files referenced by `EXT:` are internally resolved using the fallback
storage 0. To successfully resolve the file path TYPO3 must internally
use the relative instance path starting with `_assets`:
    `_assets/abcdef0[…]/Images/test.svg`

instead of the full request path starting with `subfolder/_assets`:
    `subfolder/_assets/abcdef0[…]/Images/test.svg`

Symlinks are typically used when having TYPO3 installed or linked
in a subfolder of the web server. This issue also occurs in TYPO3
v11 with composer-mode and using typo3/cms-composer-installers:^4

Review

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

Issues 1

Files 1

Review log 1927

Show 12 earlier messages
  1. Ayke Halder uploaded patch set 1 02/20/24, 11:29

  2. core-ci voted on patch set 1 V +1 02/20/24, 11:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53367

  1. Benjamin Franzke uploaded patch set 2 V +1 02/20/24, 12:34

  2. Benjamin Franzke commented on patch set 2 02/20/24, 12:34

    I've updated the commit message to what I assume you are actually using (symlink based installation). The issue would not happen if you used /path/to/composer-root/public/ as subfolder (that's not nice path, i know, but technically quite different within our codebase, as composer mode implies it is loaded from it's realpath, not from a symlink – that is only "supported" in classic mode) Please confirm in http://forge.typo3.org/issues/103157#note-4 where I asked in more detail. In general I fear this setup is not supported with the current codebase, but I'm fine to fix that bit by bit, since these codepieces are basically left-overs from the days where composer `web-dir` was allowed to be placed outside composer `app-dir`. (I'd personally would be in favor of reverting that decision, but all places that imprecisely work with `Environment::getPublicPath()` vs `NormalizedParams->getSitePath()` are subject to broken in that case (like here).
    11.5 is in priority bugfix mode and will therefore not be fixed. This is a very rare case and isn't something like a regression or so. I've therefore removed it from the releases line.
  3. core-ci voted on patch set 2 V +1 02/20/24, 12:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/53371

  4. Benjamin Franzke commented on patch set 2 CR 0 V 0 02/21/24, 07:59

    Will re-check after new feedback in http://forge.typo3.org/issues/103157#note-6 (which was other than I expected). This is not just about symlinking composer mode…
  5. Markus Klein commented on patch set 2 05/08/24, 17:53

    Reply

    This is actually about a public directory in a sub-directory of doc-root.

    ResourceFactory.php:305

    This second param is described with: > Don't use this argument. It is only used by TYPO3 in one place, which is subject to removal. I guess we need to either remove that comment or resolve this differently.
  6. Ayke Halder commented on patch set 2 05/08/24, 18:51

    Reply

    Maybe we need to rewrite the commit message again. See also first draft: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83043/1..2//COMMIT_MSG

    ResourceFactory.php:305 Reply

  7. Benni Mack commented on patch set 3 V +1 10/05/24, 08:43

    Published edit on patch set 2.
  8. Benni Mack commented on patch set 3 10/05/24, 08:43

    ResourceFactory.php:305 Reply

    Fixed this with a proper comment in the code now
  9. Benni Mack commented on patch set 3 10/05/24, 08:45

    Reply

    I have this exact issue (symlink + subdirectory) and both the current and the previous patchset helped me to identify that it solves my problem
  10. core-ci voted on patch set 3 V -1 10/05/24, 09:31 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67143

  11. core-ci commented on patch set 3 10/05/24, 11:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67143

  12. Benni Mack updated the commit message in patch set 4 V -1 10/05/24, 20:30

  13. Markus Klein voted on patch set 4 CR +1 10/05/24, 20:47

  14. Benni Mack commented on patch set 4 CR +1 V +1 10/05/24, 21:04

    Reply

    Done
  15. core-ci voted on patch set 4 V -1 10/05/24, 21:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67162

  16. Benni Mack rebased onto patch set 5 CR +1 V +1 10/05/24, 21:19

  17. core-ci voted on patch set 5 V -1 10/05/24, 21:36 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67163

  18. Ayke Halder uploaded patch set 6 V -1 10/06/24, 18:11

  19. core-ci voted on patch set 6 V -1 10/06/24, 18:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67184

  20. Ayke Halder rebased onto patch set 7 V -1 10/06/24, 18:30

  21. core-ci voted on patch set 7 V +1 10/06/24, 18:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/67185

  22. Benni Mack voted on patch set 7 CR +1 V +1 10/06/24, 20:22

  23. Benjamin Franzke voted on patch set 7 CR +1 V +1 10/07/24, 08:05

  24. Benjamin Franzke voted on patch set 7 CR +2 V +2 10/07/24, 08:30

  25. Benjamin Franzke merged patch set 8 10/07/24, 08:30