From 89c363bd807ac1c0bf279d075ec56c7bb3f2ddd7 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 22 Feb 2024 15:10:33 +0100 Subject: [PATCH] Fix handling mime type on serving libs's static files --- src/includes/routes.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/includes/routes.php b/src/includes/routes.php index 169a7382..966946f1 100644 --- a/src/includes/routes.php +++ b/src/includes/routes.php @@ -311,11 +311,12 @@ LSurl :: add_handler('#^favicon\.ico#', 'handle_favicon_ico_view', false, true, function handle_libs_file($request) { $path = LStemplate :: getLibFilePath($request -> file); if ($path && is_file($path)) { - switch (strtolower(substr($path, -4))) { - case '.css': + $info = new SplFileInfo($path); + switch ($info -> getExtension()) { + case 'css': $mime_type = 'text/css'; break; - case '.js': + case 'js': $mime_type = 'text/javascript'; break; default: