[BUGFIX] Properly return path relative to public dir in FilePathSanitizer
The assumption for FilePathSanitizer::sanitize is to return file names relative to the public directory of TYPO3. Therefore, when making a given absolute file path relative with PathUtility::getPublicResourceWebPath, we must ensure to set the second argument to false to avoid adding the current site path to the relative path, but just directly return the relative path. This bug was not covered by the test, because on CLI this API NEVER appends the current site path. Therefore the test is now adapted to simulate a frontend web request. Also streamline usage of Environment API in tests to clarify intent. Releases: master Resolves: #95644 Change-Id: I20e7e6f434e4b4ca47aca35c79ec20e659fd7114 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/71804 Tested-by:Simon Gilli <typo3@gilbertsoft.org> Tested-by:
core-ci <typo3@b13.com> Tested-by:
physikbuddha <r.kaerner@oranto.de> Tested-by:
Helmut Hummel <typo3@helhum.io> Reviewed-by:
Simon Gilli <typo3@gilbertsoft.org> Reviewed-by:
physikbuddha <r.kaerner@oranto.de> Reviewed-by:
Helmut Hummel <typo3@helhum.io>
Showing
- typo3/sysext/frontend/Classes/Resource/FilePathSanitizer.php 1 addition, 1 deletiontypo3/sysext/frontend/Classes/Resource/FilePathSanitizer.php
- typo3/sysext/frontend/Tests/Unit/Resource/FilePathSanitizerTest.php 108 additions, 43 deletions...xt/frontend/Tests/Unit/Resource/FilePathSanitizerTest.php
Please register or sign in to comment