From 3ad134c3ecf763abf3a5ffb7dca26ef64bb7b1f9 Mon Sep 17 00:00:00 2001 From: Eric Lupinacci Date: Sat, 15 Aug 2020 12:21:41 +0200 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20du=20mime=20type=20de=20t?= =?UTF-8?q?=C3=A9l=C3=A9chargement=20et=20p=C3=A9touilles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/telecharger_cache.php | 5 ++++- ezcache/ezcache.php | 2 +- inc/ezcache_cache.php | 6 ++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/action/telecharger_cache.php b/action/telecharger_cache.php index 298b8cc..21ce670 100644 --- a/action/telecharger_cache.php +++ b/action/telecharger_cache.php @@ -35,7 +35,10 @@ function action_telecharger_cache_dist() { // Header du stream $nom = basename($fichier); - header('Content-Type: application/json'); + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $type_mime = finfo_file($finfo, $fichier); + finfo_close($finfo); + header('Content-Type: ' . $type_mime); header("Content-Disposition: attachment; filename=\"${nom}\";"); header('Content-Transfer-Encoding: binary'); diff --git a/ezcache/ezcache.php b/ezcache/ezcache.php index 79692d2..5bcb8d8 100644 --- a/ezcache/ezcache.php +++ b/ezcache/ezcache.php @@ -36,7 +36,7 @@ function ezcache_cache_configurer($plugin) { $configuration_defaut = array( 'racine' => '_DIR_CACHE', // Emplacement de base du répertoire des caches. Attention c'est la chaine de la constante SPIP 'sous_dossier' => false, // Indicateur d'utilisation d'un sous-dossier - 'nom_prefixe' => '', // Préfixe du nom du cache : si nom vide devient le premier composant obligatoire. + 'nom_prefixe' => '', // Préfixe du nom du cache : si non vide devient le premier composant obligatoire. 'nom_obligatoire' => array('nom'), // Composants obligatoires ordonnés de gauche à droite. 'nom_facultatif' => array(), // Composants facultatifs 'separateur' => '', // Caractère de séparation des composants du nom '_' ou '-' ou '' si un seul composant est utilisé diff --git a/inc/ezcache_cache.php b/inc/ezcache_cache.php index 536b63a..8450195 100644 --- a/inc/ezcache_cache.php +++ b/inc/ezcache_cache.php @@ -75,10 +75,8 @@ function cache_ecrire($plugin, $cache, $contenu) { $contenu = $contenu ? array($contenu) : array(); } $contenu_cache = serialize($contenu); - } else { - if (is_string($contenu)) { - $contenu_cache = $contenu; - } + } elseif (is_string($contenu)) { + $contenu_cache = $contenu; } // Ecriture du fichier cache sécurisé ou pas suivant la configuration.