Fix handling mime type on serving libs's static files

This commit is contained in:
Benjamin Renard 2024-02-22 15:10:33 +01:00
parent e59ab4a94c
commit 89c363bd80
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -311,11 +311,12 @@ LSurl :: add_handler('#^favicon\.ico#', 'handle_favicon_ico_view', false, true,
function handle_libs_file($request) { function handle_libs_file($request) {
$path = LStemplate :: getLibFilePath($request -> file); $path = LStemplate :: getLibFilePath($request -> file);
if ($path && is_file($path)) { if ($path && is_file($path)) {
switch (strtolower(substr($path, -4))) { $info = new SplFileInfo($path);
case '.css': switch ($info -> getExtension()) {
case 'css':
$mime_type = 'text/css'; $mime_type = 'text/css';
break; break;
case '.js': case 'js':
$mime_type = 'text/javascript'; $mime_type = 'text/javascript';
break; break;
default: default: