From: Blackeye <14815724-Blackstareye@users.noreply.gitlab.com> Date: Sat, 31 Oct 2026 00:32:20 +0000 (+0100) Subject: Merge branch 'allow-disallow-extensions' into 'next-release' X-Git-Tag: 4.8.0~11 X-Git-Url: https://git.p6c8.net/jirafeau/jirafeau.git/commitdiff_plain/5180854ea1087330a8d472e63cfa0ba54b0666ea?hp=-c Merge branch 'allow-disallow-extensions' into 'next-release' Add a config option to forbid certain file extensions for uploads See merge request jirafeau/Jirafeau!39 --- 5180854ea1087330a8d472e63cfa0ba54b0666ea diff --combined script.php index bcca4f7,671aeef..39eb9d2 --- a/script.php +++ b/script.php @@@ -94,9 -94,7 +94,9 @@@ if (isset($_FILES['file']) && is_writab exit; } - if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) { + if (!isset($_POST['time'])) { + $time = jirafeau_datestr_to_int($cfg['availability_default']); + } elseif (!$cfg['availabilities'][$_POST['time']]) { echo 'Error 4: The parameter time is invalid.'; exit; } else { @@@ -110,6 -108,12 +110,12 @@@ exit; } + // Check file extension + if (!jirafeau_is_extension_allowed($cfg, $_FILES['file']['name'])) { + echo 'Error 27: This file extension is not allowed.'; + exit; + } + // Check if one time download is enabled if (!$cfg['one_time_download'] && isset($_POST['one_time_download'])) { echo 'Error 26: One time download is disabled.'; @@@ -418,6 -422,12 +424,12 @@@ elseif (isset($_GET['init_async'])) exit; } + // Check file extension + if (!jirafeau_is_extension_allowed($cfg, $_POST['filename'])) { + echo 'Error 28: This file extension is not allowed.'; + exit; + } + $type = ''; if (isset($_POST['type'])) { $type = $_POST['type']; @@@ -443,9 -453,7 +455,9 @@@ exit; } - if (!isset($_POST['time']) || !$cfg['availabilities'][$_POST['time']]) { + if (!isset($_POST['time'])) { + $time = jirafeau_datestr_to_int($cfg['availability_default']); + } elseif (!$cfg['availabilities'][$_POST['time']]) { echo 'Error 22'; exit; } else {