Bug #21714
closedt3lib_TStemplate::getFileName() handles path starting with media/ as magic
0%
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
Updated by Benni Mack almost 15 years ago
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.
Updated by Jigal van Hemert over 14 years ago
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.
Updated by Benni Mack over 14 years ago
committed to trunk (rev. 7202)
committed to TYPO3_4-3 (rev. 7203)