Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.
81049[WIP][FEATURE] Allow missing local storage files to be handled by TYPO3
Commit message
Test this change
Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch
- Check out patch set 15
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/49/81049/15 && git checkout FETCH_HEAD - Cherry-pick onto main
-
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/49/81049/15 && git cherry-pick FETCH_HEAD
Review
-
Code review CR -1 Needs a vote
- Stefan Bürk -1
-
Verified V 0 Needs a vote
- core-ci +1 CI
Issues 2
Files 12
- typo3/sysext/core/Documentation/Changelog/13.0/Feature-101942-AddNewPSR-14TYPO3CMSFrontendRequestedFileNotFoundEvent.rstnew+76 −0
- typo3/sysext/core/Documentation/Changelog/13.0/Feature-101942-IntroduceNewFileResolverMiddleware.rstnew+41 −0
- typo3/sysext/core/Documentation/Changelog/13.0/Important-101942-RemovedFileadminBlockFromRootHtaccess.rst2new+26 −0
- typo3/sysext/frontend/Classes/Event/RequestedFileNotFoundEvent.phpnew+67 −0
- typo3/sysext/frontend/Classes/Middleware/FileResolver.php3new+135 −0
- typo3/sysext/frontend/Configuration/RequestMiddlewares.php+10 −0
- typo3/sysext/frontend/Tests/Functional/Fixtures/sys_file_storage-nested-storage.csvnew+44 −0
- typo3/sysext/frontend/Tests/Functional/Fixtures/sys_file_storage-with-baseuri.csvnew+44 −0
- typo3/sysext/frontend/Tests/Functional/Fixtures/sys_file_storage.csv+3 −0
- typo3/sysext/frontend/Tests/Functional/Middleware/FileResolverTest.phpnew+381 −0
- typo3/sysext/frontend/Tests/Unit/Event/RequestedFileNotFoundEventTest.phpnew+90 −0
- typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess1+3 −2
Review log 2237
Show 612 earlier messages
-
Stefan Bürk uploaded patch set 1 09/18/23, 15:01
-
core-ci voted on patch set 1 V +1 09/18/23, 15:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46679
-
Stefan Bürk uploaded patch set 2
V +109/18/23, 16:54 -
core-ci voted on patch set 2 V -1 09/18/23, 17:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46692
-
Stefan Bürk uploaded patch set 3
V -109/18/23, 18:11 -
Stefan Bürk uploaded patch set 4 09/18/23, 18:13
-
Stefan Bürk uploaded patch set 5 09/18/23, 18:19
-
core-ci voted on patch set 3 V -1 09/18/23, 18:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46698
-
core-ci voted on patch set 4 V -1 09/18/23, 18:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46699
-
core-ci voted on patch set 5 V +1 09/18/23, 18:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46702
-
Stefan Bürk uploaded patch set 6
V +109/18/23, 18:52 -
core-ci voted on patch set 6 V +1 09/18/23, 19:00 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46706
-
Stefan Bürk uploaded patch set 7
V +109/18/23, 20:32 -
core-ci voted on patch set 7 V +1 09/18/23, 20:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46711
-
Stefan Bürk uploaded patch set 8
V +109/18/23, 21:28 -
core-ci voted on patch set 8 V +1 09/18/23, 21:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46719
-
Stefan Bürk uploaded patch set 9
V +109/19/23, 09:37 -
Stefan Bürk updated the commit message in patch set 10 09/19/23, 09:42
-
core-ci voted on patch set 9 V +1 09/19/23, 09:44 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46747
-
Benni Mack commented on patch set 10 09/19/23, 09:45
-
core-ci voted on patch set 10 V +1 09/19/23, 09:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46748
-
Oliver Hader commented on patch set 10 09/19/23, 11:34
I like the idea. Maybe it's possible to prepare the new middleware for existing files as well (like "ext:secure_download"). For the time being, the implementation would just cover the missing-resource aspect (like done already).MissingLocalStorageFileHandler.php:55Just `Not found` (W3C)MissingLocalStorageFileHandler.php:80Check port (if given) as well. And what about the path part of the URI, like in `https://anyhost.it:8443/cms/fileadmin/`?MissingLocalStorageFileHandler.php:108In total might look like the following: ``` return ``` substr_count($a['storagePath']) <=> substr_count($b['storagePath']) ?: mb_strlen($a['storagePath']) <=> mb_strlen($b['storagePath']); ``` (`subst_count` replaces the explicit split & count) -
Stefan Bürk uploaded patch set 11
V +109/19/23, 11:36 -
core-ci voted on patch set 11 V +1 09/19/23, 11:46 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46765
-
Stefan Bürk uploaded patch set 12
V +109/19/23, 11:47 -
core-ci voted on patch set 12 V +1 09/19/23, 12:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46766
-
Stefan Bürk uploaded patch set 13
V +109/19/23, 14:50 -
core-ci voted on patch set 13 V -1 09/19/23, 15:01 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46797
-
Stefan Bürk commented on patch set 13 09/19/23, 15:04
Reply
If the request uri directly matches existing files, they are handled by the Webserver before hand. Currently, only not existing directory or file requests are dispatched to TYPO3. `ext:secure_download` uses a prefix which would not find a local storage here anyway for know, and no handling would occure. However, I changed the class name for now to be more open for the future and added some todo comments into the code - for additional events. With additional events, I would become possible to resolve non-public storages through a dispatched event. Not sure if we can do it right here. Or with a routing configuration (which was a idea from Benjamin). We will see. If we could match a storage, and need to match a file in the storage after some transformations, we could further extend the middleware with additional event and handlings. I would say, that that could count as a prepartion. What would you say ? First goal was to be able to handle not-existing files with ext:redirects - or now additionally with the event in this middleware.MissingLocalStorageFileEvent.php:30ReplyDoneMissingLocalStorageFileHandler.php:55ReplyDoneMissingLocalStorageFileHandler.php:80Reply UnresolvedIf a storage provides a full uri (baseUri) override, we are skipping it if it does not match the current request. Not sure, if we should just remove the check here and matching the path part only. I would keep the check(with the additional port check) for now, with the option to remove it later if we need to catch it here. The `path` part is checked later, no need to do it here.MissingLocalStorageFileHandler.php:108Reply UnresolvedYour comment on here looks weired. I changed the implementation. Hopefully it matches now what you meant. -
Stefan Bürk uploaded patch set 14
V -109/19/23, 15:06 -
core-ci voted on patch set 14 V +1 09/19/23, 15:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46798
-
Benjamin Franzke commented on patch set 14 09/20/23, 11:32
Important-101942-RemovedFileadminBlockFromRootHtaccess.rst:6UnresolvedHm, this wasn't a block – it is rather an exclusion from URL rewriting. Maybe: "Allowed custom fileadmin URL rewriting for missing files via root .htaccess"Important-101942-RemovedFileadminBlockFromRootHtaccess.rst:16Unresolvedsee above, they are not blocked, but excluded from URL rewriting.FileResolver.php:93UnresolvedisFileResolver.php:118UnresolvedextensionsFileResolver.php:118Unresolvedhandyroot-htaccess:323UnresolvedThe middleware has been renamed -
Stefan Bürk updated the commit message in patch set 15
V +109/20/23, 11:56 -
Stefan Bürk commented on patch set 15 CR -1 09/20/23, 11:58
Unresolved
Delaying the patch - there are more things to check and pre-work needed: * SiteResolver - eventually redirect beforehand because of base and default language * Refactoring the determination into the SiteResolver directly * `sys_file_storage`: Migration to file as it is configuration and not content (+ deployable); or at least some kind of lookup cache to avoid database queries for pure storage configuration loadings. * .... -
core-ci voted on patch set 15 V +1 09/20/23, 12:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46877
-
Benni Mack marked it work in progress 04/21/26, 14:55
-
Benni Mack wrote 04/21/26, 14:55
Removed cc Benni Mack.
MissingLocalStorageFileEvent.php:30