From 62e1e85f4598e4a6ece390afa6944340c97baae2 Mon Sep 17 00:00:00 2001
From: pratushraj
Date: Tue, 6 Dec 2022 11:36:39 +0530
Subject: [PATCH] #23115
---
htdocs/core/lib/files.lib.php | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index aefc89bcc04..d6e30e93b34 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2434,10 +2434,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
// Find the subdirectory name as the reference. For example original_file='10/myfile.pdf' -> refname='10'
if (empty($refname)) {
$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))."/");
- }
+ }
+
+ 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