Review main Abandoned

71806[BUGFIX] Properly return path relative to public dir in FilePathSanitizer

Helmut Hummel CR 0 V 0 Normal +118 −53 updated 10/26/21, 09:38

Commit message

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.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 1219

  1. Helmut Hummel uploaded patch set 1 10/15/21, 11:41

  2. Helmut Hummel updated the commit message in patch set 2 10/15/21, 11:48

  3. core-ci voted on patch set 1 V +1 10/15/21, 11:57 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18173

  4. core-ci voted on patch set 2 V +1 10/15/21, 12:04 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18174

  5. Simon Gilli commented on patch set 2 10/15/21, 12:11

    The change looks good but I got some questions regarding the unit test.

    FilePathSanitizerTest.php:71

    Why the be entry point?

    FilePathSanitizerTest.php:76

    Why within public?

    FilePathSanitizerTest.php:77

    Why adding /public here?

    FilePathSanitizerTest.php:80

    And here?
  6. Helmut Hummel uploaded patch set 3 10/15/21, 12:51

  7. Helmut Hummel uploaded patch set 4 10/15/21, 12:56

  8. Helmut Hummel commented on patch set 4 10/15/21, 12:58

    FilePathSanitizerTest.php:71 Reply

    Done

    FilePathSanitizerTest.php:76 Reply

    project path should stay, correct. fixed that

    FilePathSanitizerTest.php:77 Reply

    to simulate a composer installation where project path and public path differ

    FilePathSanitizerTest.php:80 Reply

    Done
  9. Helmut Hummel uploaded patch set 5 10/15/21, 12:59

  10. Simon Gilli commented on patch set 5 V -1 10/15/21, 13:01

    On it...
  11. core-ci voted on patch set 3 V +1 10/15/21, 13:10 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18187

  12. core-ci voted on patch set 4 V +1 10/15/21, 13:10 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18188

  13. core-ci voted on patch set 5 V +1 10/15/21, 13:15 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18189

  14. Helmut Hummel uploaded patch set 6 10/15/21, 13:56

  15. core-ci voted on patch set 6 V +1 10/15/21, 14:16 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18193

  16. Simon Gilli updated the commit message in patch set 7 10/15/21, 15:04

  17. Simon Gilli voted on patch set 7 V +1 CR +1 10/15/21, 15:08

  18. core-ci voted on patch set 7 V +1 10/15/21, 15:25 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18195

  19. Helmut Hummel abandoned the change 10/26/21, 09:38

    Abandoned in favor of the original authorship https://review.typo3.org/c/Packages/TYPO3.CMS/+/71804