Project

General

Profile

Actions

Bug #93860

closed

Online media helpers (YouTubeHelper, VimeoHelper) preview images unusable in composer mode

Added by Jan Kornblum over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2021-04-06
Due date:
% Done:

100%

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

Description

When in composer mode, the online media helpers create preview images in locations like "./var/transient/youtube_1e65d7002154f3586b97bd19d2787829.jpg". But this files can't be accessed from e.g. "<f:image>" any longer, because "ResourceFactory::retrieveFileOrFolderObject()" wrongly returns a (non existing) folder object instead of file object. This is the case because "ResourceFactory::retrieveFileOrFolderObject()" uses "Environment::getPublicPath()" in behind but paths like "/var/transient/" are not public.

Steps 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" instead of "media" viewhelper, this automatically reads or creates the thumbnail)

This crashes the frontend.

Solution: Let the online media helpers create the preview images not inside "/var/transient" but in a real "public" path instead.


Related issues 4 (1 open3 closed)

Related to TYPO3 Core - Bug #93823: ResourceFactory::retrieveFileOrFolderObject() wrongly returns Folder instead of File objectNew2021-03-26

Actions
Related to TYPO3 Core - Feature #84545: Use dynamic path for typo3temp/var/ClosedBenni Mack2018-03-28

Actions
Related to TYPO3 Core - Bug #72822: Move all typo3temp files below typo3temp/var or typo3temp/assetsClosed2016-01-19

Actions
Related to TYPO3 Core - Task #72580: Move publicly accessible files to typo3temp/assets/ClosedBenni Mack2016-01-08

Actions
Actions #1

Updated by Jan Kornblum over 3 years ago

  • Related to Bug #93823: ResourceFactory::retrieveFileOrFolderObject() wrongly returns Folder instead of File object added
Actions #2

Updated by Frans Saris over 3 years ago

  • Related to Feature #84545: Use dynamic path for typo3temp/var/ added
Actions #3

Updated by Frans Saris over 3 years ago

  • Related to Bug #72822: Move all typo3temp files below typo3temp/var or typo3temp/assets added
Actions #4

Updated by Frans Saris over 3 years ago

  • Related to Task #72580: Move publicly accessible files to typo3temp/assets/ added
Actions #5

Updated by Frans Saris over 3 years ago

Jan,

Changing the temp folder to a public one would probably fix this.

Use Environment::getPublicPath() instead of Environment::getVarPath() in \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\AbstractOnlineMediaHelper

Introduced here https://review.typo3.org/c/Packages/TYPO3.CMS/+/56413/9/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/AbstractOnlineMediaHelper.php#122

But think that the transient folder is also not correct. Should be something like /assets/online-media-preview/

So result:

    /**
     * Get temporary folder path to save preview images
     *
     * @return string
     */
    protected function getTempFolderPath()
    {
        $path = Environment::getPublicPath() . '/assets/online-media-preview/';
        if (!is_dir($path)) {
            GeneralUtility::mkdir_deep($path);
        }
        return $path;
    }

The folder name was changed here https://review.typo3.org/c/Packages/TYPO3.CMS/+/46096/14/typo3/sysext/core/Classes/Resource/OnlineMedia/Helpers/AbstractOnlineMediaHelper.php#121 and

But I'm not 100% sure if this would be the correct solution. As this is only a temp file. Maybe the view shouldn't depend on this file, but the <f:image viewhelper should create a `_processed` file that would be in `typo3temp/assets`.

Start of the folder move was here https://review.typo3.org/c/Packages/TYPO3.CMS/+/45669/ and there is clearly states it should be a public folder.

Actions #6

Updated by Frans Saris over 3 years ago

I think it would be even better to rename the method:

    /**
     * Get publicly accessible temporary folder path to save preview images
     *
     * @return string
     */
    protected function getPublicTempFolderPath()
    {
        $path = Environment::getPublicPath() . '/assets/online-media-preview/';
        if (!is_dir($path)) {
            GeneralUtility::mkdir_deep($path);
        }
        return $path;
    }
Actions #7

Updated by Benni Mack over 3 years ago

Actually, the preview images should be special FAL images or processed files in the future, as the local setup completely bypasses any useful handling for our File-system abstraction layer.

Actions #8

Updated by Gerrit Code Review over 3 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472

Actions #9

Updated by Gerrit Code Review over 3 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472

Actions #10

Updated by Gerrit Code Review over 3 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/69472

Actions #11

Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70213

Actions #12

Updated by Benni Mack over 3 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #13

Updated by Gerrit Code Review over 3 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70214

Actions #14

Updated by Benni Mack over 3 years ago

  • Status changed from Under Review to Resolved
Actions #15

Updated by Benni Mack over 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF