Issue Bug Closed

#93823ResourceFactory::retrieveFileOrFolderObject() wrongly returns Folder instead of File object

Jan Kornblum 03/26/21, 23:07 updated 12/02/25, 14:33

Description

In some situations, ResourceFactory::retrieveFileOrFolderObject($input) wrongly returns a Folder object instead of a File object.

This occured in a composer based installation when $input is anything outside public web path like “var/www/html/var/transient/youtube_1e65d7002154f3586b97bd19d2787829.jpg” (a preview image created by TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\YouTubeHelper).

The wrong check seems to happen in line 485…

$input = PathUtility::getCanonicalPath(ltrim($input, '/'));
if (@is_file(Environment::getPublicPath() . '/' . $input)) {
    // only the local file
    return $this->getFileObjectFromCombinedIdentifier($input);
}
// only the local path
return $this->getFolderObjectFromCombinedIdentifier($input);

It should be easy to reproduce:

  • Upload any youtube or vimeo video from backend
  • Assign it to any record or model
  • In FLUID, let it be rendered using “<f:image>“ (when using “image” tag instead of “media” viewhelper, this automatically creates the thumbnail)</f:image>

This crashes the frontend!

I don’t know if this bug is part of ResourceFactory::retrieveFileOrFolderObject() rather than YouTubeHelper::getPreviewImage() (which might create the thumbnail on the wrong location.

Independent from this being related to the “online media stuff”, anyway the “retrieveFileOrFolderObject()” must not return a folder object in this case (perhaps better just “false” or throw an exception when neither file nor folder?).

Reviews 2

History 1320

  1. Jan Kornblum changed description 03/26/21, 23:08

  2. Jan Kornblum changed description 03/26/21, 23:09

  3. Jan Kornblum changed description 03/29/21, 10:39

  4. Jan Kornblum changed description 03/29/21, 10:41

  5. Jan Kornblum changed description 03/29/21, 10:44

  6. Jan Kornblum changed description 03/30/21, 08:30

  7. Jan Kornblum changed description 03/31/21, 11:01

  8. Jan Kornblum changed description 04/06/21, 14:30

  9. Jan Kornblum changed description 04/06/21, 14:31

  10. Jan Kornblum changed Related to #93860 04/06/21, 15:40

  11. Gerrit Code Review pushed patch set 1 for main to change 89115 status New Under Review 04/15/25, 12:01

  12. Gerrit Code Review pushed patch set 2 for main to change 89115 04/15/25, 12:25

  13. Gerrit Code Review pushed patch set 3 for main to change 89115 04/16/25, 06:52

  14. Gerrit Code Review pushed patch set 1 for 13.4 to change 89134 04/16/25, 09:08

  15. Gerrit Code Review pushed patch set 2 for 13.4 to change 89134 04/16/25, 09:08

  16. Benni Mack commented and changed status Under Review Resolved done 0 % 100 % 04/16/25, 09:10

    Applied in changeset commit:1c092692abd778810be17ccf5af0000b5eb4baa0.

  17. Gerrit Code Review pushed patch set 3 for 13.4 to change 89134 status Resolved Under Review 04/16/25, 09:12

  18. Gerrit Code Review pushed patch set 4 for 13.4 to change 89134 04/16/25, 09:16

  19. Benni Mack commented and changed status Under Review Resolved 04/16/25, 09:30

    Applied in changeset commit:edcad5183537cc56cb26ee8a9cb445a3e18805f2.

  20. Benni Mack changed status Resolved Closed 12/02/25, 14:33