Issue Bug Closed

#50538Allowed Characters for Filenames

Lucas Bremgartner 07/29/13, 21:48 updated 10/02/18, 12:12

Description

If working with Image-Files for Retina-Displays there is the need for filenames with the character in it, e.g. image2x.jpg.

The character @ is prevented by the function cleanFileName in class.t3lib_basicfilefunc.php (respectively BasicFileUtility.php for version >6.0).

But the behavior is inconsistent. If $GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’][‘UTF8filesystem’] is set, the character @ is allowed, because \x40 is not excluded by the regex.

Therefor, I suggest to allow the @ character in filenames in non-utf8-filesystems as well.

To achieve this, the line

$cleanFileName = preg_replace('/[^.[:alnum:]_-]/', '_', trim($fileName));

should be changed to

$cleanFileName = preg_replace('/[^.[:alnum:]@_-]/', '_', trim($fileName));

Reviews 4