Actions
Bug #99404
closedInvalide relative path given by getPublicUrl()
Start date:
2022-12-21
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
11
PHP Version:
8.0
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:
Description
On a FileReference, if you try to get the public Url with :
$myFile->getOriginalResource()->getPublicUrl()
you get a relative URL like this :
'/uploads/tx_myext/MyTestFile.pdf'
but this URL is prefixed with a slash and then cannot be used with functions like fopen()
Before TYPO3 V11, the method getPublicUrl() return a path like this :
'uploads/tx_myext/MyTestFile.pdf'
Updated by Christoph Lehmann almost 2 years ago
If you wanna work with a file in the filesystem, then you can do it like this
// Path to local file (either original or copied to some temporary local location $filePath = $file->getStorage()->getFileForLocalProcessing($file);
getPublicUrl() returns a publicly accessible URL for this file and it is not meant to be used in filesystem context.
Is it okay to close the issue for this reason?
Updated by Florian Rival almost 2 years ago
Thanks for you answer.
In my case, it works with that :
$myFile->getOriginalResource()->getForLocalProcessing();
You can close this issue.
Actions