From 365fffddf5e4bb0b2178781eea7c07e6ce027ef3 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 26 Feb 2018 11:00:49 +0100 Subject: [PATCH] Fix: missing object entity --- htdocs/core/class/html.formfile.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index ffe5a459699..b7b94e7e644 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,10 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); + // Get object entity + preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir).'$/', $filedir, $regs); + $entity = ((! empty($regs[1]) && $regs[1] > 1) ? $regs[1] : $conf->entity); + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) @@ -903,7 +907,7 @@ class FormFile } // Download - $tmpout.= '