Bug #93823

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

Added by Jan Kornblum 7 months ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2021-03-26
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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)

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?).


Related issues

Related to TYPO3 Core - Bug #93860: Online media helpers (YouTubeHelper, VimeoHelper) preview images unusable in composer modeClosed2021-04-06

Actions
#1

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#2

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#3

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#4

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#5

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#6

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#7

Updated by Jan Kornblum 7 months ago

  • Description updated (diff)
#8

Updated by Jan Kornblum 6 months ago

  • Description updated (diff)
#9

Updated by Jan Kornblum 6 months ago

  • Description updated (diff)
#10

Updated by Jan Kornblum 6 months ago

  • Related to Bug #93860: Online media helpers (YouTubeHelper, VimeoHelper) preview images unusable in composer mode added

Also available in: Atom PDF