From 31a6b6029cd95b2d64baac3d9209cc15e1f928e8 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Gomez Date: Wed, 4 May 2022 00:18:58 +0200 Subject: [PATCH] Forced mime type for xml files. ----- Forzado el tipo mime para los archivos xml. --- Core/App/AppRouter.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Core/App/AppRouter.php b/Core/App/AppRouter.php index 1de2d09bc9..7d1618cb78 100644 --- a/Core/App/AppRouter.php +++ b/Core/App/AppRouter.php @@ -223,12 +223,16 @@ private function download(string $filePath) */ private function getMime(string $filePath): string { - if ('.css' === substr($filePath, -4)) { - return 'text/css'; - } + $extension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); + switch ($extension) { + case 'css': + return 'text/css'; + + case 'js': + return 'application/javascript'; - if ('.js' === substr($filePath, -3)) { - return 'application/javascript'; + case 'xml': + return 'text/xml'; } return mime_content_type($filePath);