Review main Merged

81593[BUGFIX] Use original file for ProcessedFile::getMimeType and ::getSize

Christian Weiske CR +2 V +2 Easy +26 −0 updated 03/11/24, 20:49

Commit message

When the processed files are saved in a different storage,
calling `$this->getStorage()->getFileInfoByIdentifier()`
on a ProcessedFile that uses the original file will fail.

This patch proxies the calls to the original file if necessary,
just as it is already done for e.g. exists() and getPublicUrl().

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Oliver Klee +1
    • Garvin Hicking +1
    • Guido Schmechel +1
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Garvin Hicking +1
    • core-ci +1 CI

Issues 1

Files 1

Review log 1923

  1. Christian Weiske uploaded patch set 1 10/27/23, 09:19

  2. core-ci voted on patch set 1 V -1 10/27/23, 09:26 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48280

  3. Christian Weiske uploaded patch set 2 V -1 10/27/23, 09:39

  4. Benni Mack commented on patch set 2 10/27/23, 09:45

    Hey Christian, should go in v12 as well, right?
  5. core-ci voted on patch set 2 V +1 10/27/23, 09:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48281

  6. Christian Weiske updated the commit message in patch set 3 V +1 10/27/23, 09:49

  7. Benni Mack voted on patch set 3 CR +1 10/27/23, 09:52

  8. Benni Mack voted on patch set 3 V +1 10/27/23, 09:52

  9. core-ci voted on patch set 3 V +1 10/27/23, 09:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48282

  10. Oliver Klee voted on patch set 3 CR +1 10/27/23, 10:57

  11. Garvin Hicking commented on patch set 3 11/01/23, 09:09

    ProcessedFile.php:499

    Does the method above not throw a similar exception? Don't have the chance to look it up right now. Also, do any unit/functional tests maybe need adoption to also test these two "new" accessors?
  12. Christian Weiske uploaded patch set 4 CR +1 V +1 11/01/23, 09:35

  13. Christian Weiske commented on patch set 4 11/01/23, 09:38

    ProcessedFile.php:499 Reply

    The RuntimeException comes from getStorage(), so yes getMimeType also needs it. I've added it. Sorry, I have no idea about the tests.
  14. core-ci voted on patch set 4 V +1 11/01/23, 09:43 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/48434

  15. Oliver Klee voted on patch set 4 CR +1 11/01/23, 10:12

  16. Benjamin Franzke commented on patch set 4 11/01/23, 11:53

    I think `ProcessedFile` needs to be changed to rather return a proper storage from `$this->getStorage()` depending on the result of `usesOriginalFile()`, as basically all cases where `getStorage()` is used are possibly flawed. I do understand however, if we'd rather leave that for a main-only TASK.
  17. Christian Weiske commented on patch set 4 11/02/23, 11:58

    Reply

    Just having getStorage() return the original file storage will not work, because `AbstractFile` getter methods also use `$this->properties` and other local properties that would also need to be proxied. Getting all of those correct will be tricky.
  18. Christian Weiske commented on patch set 4 11/07/23, 09:13

    Reply

    Done
  19. Benni Mack commented on patch set 4 CR +1 01/23/24, 22:19

    I think the fix is OK for the time being
  20. Guido Schmechel voted on patch set 4 CR +1 01/27/24, 21:51

  21. Garvin Hicking voted on patch set 4 CR +1 V +1 03/11/24, 18:43

  22. Georg Ringer voted on patch set 4 CR +2 V +2 03/11/24, 20:49

  23. Georg Ringer merged patch set 5 03/11/24, 20:49