Project

General

Profile

Bug #14859 » 1280_v2.diff

Administrator Admin, 2009-01-30 17:20

View differences:

t3lib/class.t3lib_basicfilefunc.php (working copy)
* @return string Output string with any characters not matching [.a-zA-Z0-9_-] is substituted by '_'
*/
function cleanFileName($fileName,$charset='') {
// remove trailing dots
$fileName = preg_replace('/\.*$/','',$fileName);
// handle UTF-8 characters
if ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] == 'utf-8' && $GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
// allow ".", "-", 0-9, a-z, A-Z and everything beyond U+C0 (latin capital letter a with grave)
......
$fileName = $this->csConvObj->specCharsToASCII($charset,$fileName);
}
$fileName = preg_replace('/[^.[:alnum:]_-]/','_',trim($fileName));
return preg_replace('/\.*$/','',$fileName);
return preg_replace('/[^.[:alnum:]_-]/','_',trim($fileName));
}
/**
(2-2/2)