Explorar el Código

FIX #23115 FIX #23116

Laurent Destailleur hace 2 años
padre
commit
ac8914eb19
Se han modificado 2 ficheros con 5 adiciones y 1 borrados
  1. 1 1
      htdocs/core/lib/files.lib.php
  2. 4 0
      htdocs/viewimage.php

+ 1 - 1
htdocs/core/lib/files.lib.php

@@ -2435,7 +2435,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
 	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'
+			// If we get the thumbs directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10'
 			$refname = basename(dirname(dirname($original_file))."/");
 		}
 	}

+ 4 - 0
htdocs/viewimage.php

@@ -228,6 +228,10 @@ $original_file = str_replace('..\\', '/', $original_file);
 
 // Find the subdirectory name as the reference
 $refname = basename(dirname($original_file)."/");
+if ($refname == 'thumbs') {
+	// If we get the thumbs directory, we must go one step higher. For example original_file='10/thumbs/myfile_small.jpg' -> refname='10'
+	$refname = basename(dirname(dirname($original_file))."/");
+}
 
 // Check that file is allowed for view with viewimage.php
 if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) {