very restrictive file name clearing

(windows sucks)
This commit is contained in:
steeffeen 2014-06-29 22:18:14 +02:00
parent 5a09db0e72
commit 2fd369d746

View File

@ -56,9 +56,9 @@ abstract class FileUtil {
*/
public static function getClearedFileName($fileName) {
$fileName = Formatter::stripCodes($fileName);
$fileName = str_replace(array(DIRECTORY_SEPARATOR, '\\', '/', ':', '*', '?', '"', '<', '>', '|'), '_', $fileName);
$fileName = preg_replace('/[^[:print:]]/', '', $fileName);
$fileName = Formatter::utf8($fileName);
$fileName = preg_replace('/[^0-9A-Za-z\-\+\.\_\ ]/', null, $fileName);
$fileName = preg_replace('/ /', '_', $fileName);
return $fileName;
}