From f661b926fa42d1aba99f610e63e6de731feb1408 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 7 May 2019 14:33:17 +0200 Subject: [PATCH] FIX : use dol_sanitizeFileName() function to remove double spaces in filenames, as well as done on document.php when we want to download pdf Example : if you upload a file like "my file.pdf" (with 2 spaces), it's impossible to download it after. then we have to remove at least 1 space --- htdocs/core/lib/files.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 210626f461c..8a1fecd999a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1556,7 +1556,8 @@ 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'])); - + $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'