1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-01-18 04:59:16 +02:00

[Web] Fix resource.php and /cache/ warning message

If http://mail.example.tld/cache/ or http://mail.example.tld/resource.php are called without the required parameters it returns one or two warnings
This commit is contained in:
Vincent Simon 2022-03-20 22:05:28 +01:00
parent 161130c116
commit deac5ad2fe

View File

@ -1,6 +1,15 @@
<?php <?php
if (!isset($_GET['file']) ) {
http_response_code(404);
exit;
}
$pathinfo = pathinfo($_GET['file']); $pathinfo = pathinfo($_GET['file']);
if (!array_key_exists('extension', $pathinfo)) {
http_response_code(404);
exit;
}
$extension = strtolower($pathinfo['extension']); $extension = strtolower($pathinfo['extension']);
$filepath = '/tmp/' . $pathinfo['basename']; $filepath = '/tmp/' . $pathinfo['basename'];