Serve only valid mime types

This commit is contained in:
Conner Harkness 2025-08-21 07:10:58 -06:00
parent 1ae5e0b8a1
commit 4340b14067

View File

@ -62,6 +62,7 @@
if (is_file($strTargetFilePath))
{
$intValid = 0;
$varMimeTypes = array(
array("/\.css$/", "text/css"),
array("/\.js$/", "application/javascript"),
@ -72,14 +73,20 @@
foreach ($varMimeTypes as $varMimeType)
if (preg_match($varMimeType[0], $strTargetFilePath))
{
header("Content-Type: {$varMimeType[1]}");
$intValid = 1;
}
if ($intValid)
{
ob_clean();
echo file_get_contents($strTargetFilePath);
ob_end_flush();
exit;
}
}
}
$varCollection = array(
"lib" => array(),