Browse Source

ne pas etre sensible a la casse de l'extension lors de sa detection

spip-3-stable
Cerdic 11 years ago
parent
commit
1314491200
  1. 6
      ecrire/inc/distant.php

6
ecrire/inc/distant.php

@ -472,12 +472,12 @@ function recuperer_infos_distantes($source, $max=0, $charger_si_petite_image = t
$t = null;
if (in_array($mime_type,array('text/plain','','application/octet-stream'))){
if (!$t
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,', $source, $rext)) {
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)) {
$t = sql_fetsel("extension", "spip_types_documents", "extension=" . sql_quote($rext[1]));
}
if (!$t
AND preg_match(",^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims",$headers,$m)
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,', $m[1], $rext)){
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)){
$t = sql_fetsel("extension", "spip_types_documents", "extension=" . sql_quote($rext[1]));
}
}
@ -490,7 +490,7 @@ function recuperer_infos_distantes($source, $max=0, $charger_si_petite_image = t
// On essaie de nouveau avec l'extension
if (!$t
AND $mime_type != 'text/plain'
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,', $source, $rext)) {
AND preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)) {
$t = sql_fetsel("extension", "spip_types_documents", "extension=" . sql_quote($rext[1]));
}

Loading…
Cancel
Save