Try a more complete sanitization

This commit is contained in:
Laurent Destailleur 2022-02-22 18:41:14 +01:00
parent eede3aaf17
commit 8a99bc3b04

View File

@ -1105,6 +1105,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = str_replace('..', '', $tmp);
return $tmp;
}
@ -1128,6 +1129,7 @@ function dol_sanitizePathName($str, $newstr = '_', $unaccent = 1)
$tmp = dol_string_nospecial($unaccent ? dol_string_unaccent($str) : $str, $newstr, $filesystem_forbidden_chars);
$tmp = preg_replace('/\-\-+/', '_', $tmp);
$tmp = preg_replace('/\s+\-([^\s])/', ' _$1', $tmp);
$tmp = str_replace('..', '', $tmp);
return $tmp;
}