[Web] Fix duplicate file extension on shortened filenames

master
andryyy 2020-12-29 15:20:46 +01:00
parent 71d8b4f7b8
commit e676617f00
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 1 additions and 0 deletions

View File

@ -185,6 +185,7 @@ elseif (!empty($_GET['id']) && ctype_alnum($_GET['id'])) {
$dl_filename = filter_var($data['attachments'][$dl_id][0], FILTER_SANITIZE_STRING); $dl_filename = filter_var($data['attachments'][$dl_id][0], FILTER_SANITIZE_STRING);
$dl_filename_short = strlen($dl_filename) > 20 ? substr($dl_filename, 0, 20) : $dl_filename; $dl_filename_short = strlen($dl_filename) > 20 ? substr($dl_filename, 0, 20) : $dl_filename;
$dl_filename_extension = pathinfo($tmpdir . $dl_filename)['extension']; $dl_filename_extension = pathinfo($tmpdir . $dl_filename)['extension'];
$dl_filename_short = preg_replace('/\.' . $dl_filename_extension . '$/', '', $dl_filename_short);
if (!is_dir($tmpdir . $dl_filename) && file_exists($tmpdir . $dl_filename)) { if (!is_dir($tmpdir . $dl_filename) && file_exists($tmpdir . $dl_filename)) {
header('Pragma: public'); header('Pragma: public');
header('Expires: 0'); header('Expires: 0');