Merge pull request #11145 from atm-gauthier/8.0_fix_filename_with_two_spaces

FIX : use dol_sanitizeFileName() function to remove double spaces in …
This commit is contained in:
Laurent Destailleur 2019-05-13 12:01:05 +02:00 committed by GitHub
commit 1626c9fb6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1556,7 +1556,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
$destfull = $info['dirname'].'/'.dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
$info = pathinfo($destfile);
$destfile = dol_sanitizeFileName($info['filename'].'.'.strtolower($info['extension']));
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
$destfile = dol_string_nohtmltag($destfile);
$destfull = dol_string_nohtmltag($destfull);
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'