From ed59a8851f3e7b243f89fde128f16db2a543aec2 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 5 May 2021 16:48:04 +0200 Subject: [PATCH] Fix #17501 : Undownloable attached file --- htdocs/core/actions_linkedfiles.inc.php | 4 ++++ htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 5 insertions(+) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index af60583118d..482f4cf1dea 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -44,6 +44,10 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); } } + if (preg_match('/__.*__/', $_FILES['userfile']['name'][$key])) { + $error++; + setEventMessages($langs->trans('ErrorWrongFileName'), null, 'errors'); + } } if (!$error) { diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 6df5438de8f..cbf7214245a 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -298,3 +298,4 @@ WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So y ErrorActionCommPropertyUserowneridNotDefined=User's owner is required ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Event Type dictionary CheckVersionFail=Version check fail +ErrorWrongFileName=Name of the file cannot have __SOMETHING__ in it \ No newline at end of file