Review main Merged

57403[TASK] Decouple TemplateService->getFileName

Benni Mack CR +2 V +2 Hard +455 −136 updated 07/02/18, 10:48

Commit message

TemplateService in TYPO3 frontend is responsible for
fetching sys_template records and sorting TypoScript
related things out, but also contains one method,
which is nowadays completely separate from
sys_template: "getFileName".

This method checks for valid syntax and returns
a proper string then (resolves "EXT:... syntax"
and valdiates against available paths).

The logic is frontend-related, thus moved
to EXT:frontend/FilePathSanitizer.

The old functionality in TemplateService is
deprecated, along with the public property "fileCache".

Review

  • Code review CR +2
    • Benni Mack +2
    • Anja Leichsenring +1
    • Christian Kuhn +1
  • Verified V +2
    • Benni Mack +2
    • Anja Leichsenring +1
    • Christian Kuhn +1
    • TYPO3com +1 CI

Issues 1

Files 14

Review log 2030

Show 45 earlier messages
  1. Benni Mack uploaded patch set 1 06/28/18, 07:24

  2. Mathias Brodala commented on patch set 1 06/28/18, 07:30

    ResourceSanitizer.php:30

    I'd vote for naming this "FilePathSanitizer", otherwise the method below should be named "sanitizeFilePath".
  3. TYPO3com voted on patch set 1 V -1 06/28/18, 07:32 Completed build in 08m 26s on Thu, 28 Jun, 09:32 AM Test Summary: 12 of 33103 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24951

  4. Patrick Schriner commented on patch set 1 06/28/18, 08:37

    This will have side effects on "fake frontends" if it will be impossible to manipulate allowedPaths (a bit abusive) as it is a singleton. It shouldn't use hard coded path segmements which could be resolved using the Environment class (see #85286)
  5. Benni Mack uploaded patch set 2 06/28/18, 17:40

  1. TYPO3com voted on patch set 2 V -1 06/28/18, 17:56 Completed build in 15m 05s on Thu, 28 Jun, 07:56 PM Test Summary: 7 of 33095 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-24966

  2. Benni Mack uploaded patch set 3 07/01/18, 15:55

  3. TYPO3com voted on patch set 3 V -1 07/01/18, 16:03 Completed build in 07m 34s on Sun, 1 Jul, 06:03 PM Test Summary: 10 of 33125 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25000

  4. Benni Mack uploaded patch set 4 07/01/18, 16:09

  5. TYPO3com voted on patch set 4 V -1 07/01/18, 16:18 Completed build in 08m 27s on Sun, 1 Jul, 06:18 PM Test Summary: 7 of 33125 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25001

  6. Benni Mack uploaded patch set 5 07/01/18, 16:20

  7. TYPO3com voted on patch set 5 V -1 07/01/18, 16:28 Completed build in 08m 26s on Sun, 1 Jul, 06:28 PM Test Summary: 4 of 33126 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25003

  8. Benni Mack uploaded patch set 6 07/01/18, 16:33

  9. TYPO3com voted on patch set 6 V +1 07/01/18, 16:41 Completed build in 08m 11s on Sun, 1 Jul, 06:41 PM Test Summary: 32877 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25004

  10. Benni Mack commented on patch set 7 07/01/18, 16:43

    Published edit on patch set 6.
  11. TYPO3com voted on patch set 7 V -1 07/01/18, 16:50 Completed build in 07m 42s on Sun, 1 Jul, 06:50 PM Test Summary: 1 of 33126 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25005

  12. TYPO3com voted on patch set 7 V +1 07/01/18, 17:01 Completed build in 26m 26s on Sun, 1 Jul, 07:01 PM Test Summary: 32877 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25005

  13. Wouter Wolters commented on patch set 7 07/01/18, 17:16

    Deprecation-85445-TemplateService-getFileName.rst:16

    acted as

    GifBuilder.php:679

    string|null

    FilePathSanitizer.php:32

    This are the
  14. Frans Saris commented on patch set 7 07/01/18, 19:41

    FilePathSanitizer.php:66

    IMO sanitize is the wrong name here. It tries to resolve a path and validates it when relative. If it could be parsed as a absolute url then there isn't any sanitizing at all. Think a better name would be `resolve()`
  15. Björn Jacob commented on patch set 7 07/01/18, 20:33

    "validates"

    FilePathSanitizer.php:32 Reply

    "These" instead of "This"
  16. Benni Mack uploaded patch set 8 07/02/18, 07:03

  17. Benni Mack commented on patch set 7 07/02/18, 07:06

    FilePathSanitizer.php:66 Reply Unresolved

    hmm, I think resolve() is generic, and is used too much throughout the core. The main thing that is resolving is `EXT:...` syntax, the other is actually checking if everything matches. Sanitizing came from the idea of returning a "clean" string. Now it throws an exception if something is wrong. tbh, I don't care too much on the name here, whatever the majority decides on, I will adapt the patch.
  18. TYPO3com voted on patch set 8 V +1 07/02/18, 07:12 Completed build in 08m 32s on Mon, 2 Jul, 09:12 AM Test Summary: 32877 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25009

  19. Christian Kuhn commented on patch set 8 CR -1 07/02/18, 09:21

    on it.
  20. Christian Kuhn uploaded patch set 9 07/02/18, 10:14

  21. Christian Kuhn commented on patch set 9 V +1 CR +1 07/02/18, 10:14

    changed only minor things.
  22. TYPO3com voted on patch set 9 V +1 07/02/18, 10:22 Completed build in 08m 17s on Mon, 2 Jul, 12:22 PM Test Summary: 32877 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-25018

  23. Anja Leichsenring voted on patch set 9 V +1 CR +1 07/02/18, 10:29

  24. Benni Mack voted on patch set 9 V +2 CR +2 07/02/18, 10:48

  25. Benni Mack merged patch set 10 07/02/18, 10:48