Leuchtfeuer / typo3-aws-tools

This extension connects your TYPO3 instance to Amazon CloudFront. It rewrites all file paths in the frontend to match your CDN domain. You also have the possibility to invalidate Amazon CloudFront entries.
https://www.Leuchtfeuer.com
GNU General Public License v2.0
2 stars 5 forks source link

[BUGFIX] Fix wrong CDN url generation for files like .youtube or .vimeo #11

Closed davkraid closed 1 week ago

davkraid commented 1 year ago

There is a problem with .youtube or .vimeo files and an active CDN. For example:

If you try to get a URL to a YouTube or Vimeo video using a Fluid View Helper like this:

<f:link.typolink parameter="{file.publicUrl}"></f:link.typolink>

The extension resolves the URL with the CDN url like this:

https://cdn.domain.com/fileadmin/user_uploads/video_file.youtube

But what I need is acutally the URL to the video on YouTube/Vimeo:

https://www.youtube.com/watch?v=dQw4w9WgXcQ

The processing of .youtube/.vimeo files will take place AFTER the event of this extension but then the wrong CDN link is already generated (see https://github.com/TYPO3/typo3/blob/808ef61a53bc1e7ef65b715c13727b0f2d086c24/typo3/sysext/core/Classes/Resource/ResourceStorage.php#L1393C39-L1393C39).

I fixed the problem by checking in the CDN event if the requested file is not part of the OnlineMediaHelper class and skip the CDN link generation.