Skip to content
Extraits de code Groupes Projets
Valider a3ca245b rédigé par ARNO*'s avatar ARNO*
Parcourir les fichiers

Bug bizarre de upload en presence d'un sous-dossier

parent 94faffca
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -197,7 +197,8 @@ function preg_files($dir, $pattern=-1 /* AUTO */ ) { ...@@ -197,7 +197,8 @@ function preg_files($dir, $pattern=-1 /* AUTO */ ) {
if ($pattern == -1) if ($pattern == -1)
$pattern = "^$dir"; $pattern = "^$dir";
$fichiers = array(); $fichiers = array();
$dir = preg_replace(',/[^/]*$,', '', $dir); // A quoi sert cette ligne?
// $dir = preg_replace(',/[^/]*$,', '', $dir);
if (@is_dir($dir) AND is_readable($dir) AND $d = @opendir($dir)) { if (@is_dir($dir) AND is_readable($dir) AND $d = @opendir($dir)) {
while (($f = readdir($d)) !== false) { while (($f = readdir($d)) !== false) {
...@@ -209,17 +210,18 @@ function preg_files($dir, $pattern=-1 /* AUTO */ ) { ...@@ -209,17 +210,18 @@ function preg_files($dir, $pattern=-1 /* AUTO */ ) {
if (preg_match(",$pattern,i", "$dir/$f")) if (preg_match(",$pattern,i", "$dir/$f"))
$fichiers[] = "$dir/$f"; $fichiers[] = "$dir/$f";
} else if (is_dir("$dir/$f")) { } else if (is_dir("$dir/$f")) {
$fichiers = array_merge($fichiers, $beginning = $fichiers;
preg_files("$dir/$f", $pattern)); $end = preg_files("$dir/$f", $pattern);
$fichiers = array_merge((array)$beginning, (array)$end);
} }
} }
} }
closedir($d); closedir($d);
sort($fichiers); sort($fichiers);
} }
else else {
spip_log("repertoire $dir absent ou illisible"); spip_log("repertoire $dir absent ou illisible");
}
sort($fichiers); sort($fichiers);
return $fichiers; return $fichiers;
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter