diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 70f68a31894..360248a741e 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1207,7 +1207,7 @@ class FormFile
$editline = 1;
} else {
$filenametoshow = preg_replace('/\.noexe$/', '', $file['name']);
- print dol_trunc($filenametoshow, 200);
+ print dol_escape_htmltag(dol_trunc($filenametoshow, 200));
print '';
}
// Preview link
diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php
index 7839198d913..48c15f92aa2 100644
--- a/htdocs/ecm/file_card.php
+++ b/htdocs/ecm/file_card.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2008-2020 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -126,7 +126,7 @@ if ($action == 'update')
$error = 0;
$oldlabel = GETPOST('urlfile', 'alpha');
- $newlabel = GETPOST('label', 'alpha');
+ $newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
$shareenabled = GETPOST('shareenabled', 'alpha');
//$db->begin();
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 4db7b897b6a..e009dfc6891 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -127,7 +127,6 @@ if ($action == 'confirm_deletefile')
$upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
$file = $upload_dir."/".GETPOST('urlfile', 'alpha');
-
$ret = dol_delete_file($file); // This include also the delete from file index in database.
if ($ret)
{