Project

General

Profile

Actions

Bug #45489

closed

t3lib_stdGraphic: escaping of filenames does not work when using brackets ()

Added by Markus Kappe almost 12 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Category:
Image Cropping
Target version:
-
Start date:
2013-02-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

Description

When you got an image that has brackets () in its filename, resizing (i.e. all ImageMagick actions) won't work. The reason is that the filenames with brackets need to be surrunded by quotes when passed to the IM command. But the quotes are removed (after properly applied).

The code from 4.5.22:

    protected function wrapFileName($inputName) {
        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
            $currentLocale = setlocale(LC_CTYPE, 0);
            setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
        }
        $escapedInputName = escapeshellarg($inputName);
        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
            setlocale(LC_CTYPE, $currentLocale);
        }
            // if escapeshellarg didn't change anything and if there is no whitespace in the original string
            // keep the original for (partial) safe_mode compatibility
        if (trim($escapedInputName, '"\'') === $inputName && !preg_match('/[[:space:]]/', $inputName)) {
///////////// remove the next line for bugfix ////////////////////////
            $escapedInputName = $inputName;
        }
        return $escapedInputName;
    }
Actions

Also available in: Atom PDF