Bug #21714
closed
t3lib_TStemplate::getFileName() handles path starting with media/ as magic
Added by Jigal van Hemert almost 15 years ago.
Updated over 14 years ago.
Description
The function t3lib_TStemplate::getFileName() considers any path starting with 'media/' like it is a shortcut to 'typo3/sysext/cms/tslib/media/' (which was the case in older TYPO3 installations).
If a directory 'media' exists the files inside this directory cannot be used in Typoscript FILE objects, etc.
The check if the file exists should be performed first and if that fails the path can be adjusted if it starts with 'media/'
(issue imported from #M12794)
Files
Hey Jigal,
I created a patch that fixes this issue. Can you try it out and see if it works?
The patch uses the call to the t3lib_extMgm class to get the path to the CMS directory, so it's not hardcoded anymore. It also speeds up the process as it uses strpos instead of strstr.
If it does work for you, could you send this patch to the Core list?
Thank you.
Benni.
Sorry, missed the message with the patch. Tested with 4.4-trunk and it works brilliantly!
Test case:
- create directory in 'root' of website and put an image in that folder
- Use Typoscript like:
10 = IMAGE
10 {
# file which exists in real folder 'media'
file = media/typo3bedroom.jpg
}
20 = IMAGE
20 {
#file in real folder fileadmin
file = fileadmin/other_one.png
}
30 = IMAGE
30 {
#file in 'magic' folder media (typo3/sysext/cms/tslib/media/...)
file = media/logos/set.gif
}
The first image didn't work before the patch.
committed to trunk (rev. 7202)
committed to TYPO3_4-3 (rev. 7203)
Also available in: Atom
PDF