This commit is contained in:
Laurent Destailleur 2021-09-09 19:21:32 +02:00
parent a80950b96d
commit ffd7f60830

View File

@ -2291,9 +2291,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$sqlprotectagainstexternals = ''; $sqlprotectagainstexternals = '';
$ret = array(); $ret = array();
// Find the subdirectory name as the reference. For exemple original_file='10/myfile.pdf' -> refname='10' // Find the subdirectory name as the reference. For example original_file='10/myfile.pdf' -> refname='10'
if (empty($refname)) { if (empty($refname)) {
$refname = basename(dirname($original_file)."/"); $refname = basename(dirname($original_file)."/");
if ($refname == 'thumbs') {
// If we get the thumbns directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10'
$refname = basename(dirname(dirname($original_file))."/");
}
} }
// Define possible keys to use for permission check // Define possible keys to use for permission check