Project

General

Profile

Actions

Bug #21714

closed

t3lib_TStemplate::getFileName() handles path starting with media/ as magic

Added by Jigal van Hemert over 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2009-11-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

12794.patch (927 Bytes) 12794.patch Administrator Admin, 2009-12-24 16:59
Actions #1

Updated by Benni Mack over 14 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.

Actions #2

Updated by Jigal van Hemert about 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.

Actions #3

Updated by Benni Mack about 14 years ago

committed to trunk (rev. 7202)
committed to TYPO3_4-3 (rev. 7203)

Actions

Also available in: Atom PDF