From e676617f00d9c03c0f500776760a2fcc44e0e67d Mon Sep 17 00:00:00 2001 From: andryyy Date: Tue, 29 Dec 2020 15:20:46 +0100 Subject: [PATCH] [Web] Fix duplicate file extension on shortened filenames --- data/web/inc/ajax/qitem_details.php | 1 + 1 file changed, 1 insertion(+) diff --git a/data/web/inc/ajax/qitem_details.php b/data/web/inc/ajax/qitem_details.php index 5245be94..35e599ca 100644 --- a/data/web/inc/ajax/qitem_details.php +++ b/data/web/inc/ajax/qitem_details.php @@ -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_short = strlen($dl_filename) > 20 ? substr($dl_filename, 0, 20) : $dl_filename; $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)) { header('Pragma: public'); header('Expires: 0');