From cf4d0517e831ed713bbc345abb7fcb8dc221547d Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 5 Oct 2025 20:53:56 +0500 Subject: fix: file extension was duplicated in filename on download --- public/index.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'public/index.php') diff --git a/public/index.php b/public/index.php index 2ee42ae..f4d8e51 100644 --- a/public/index.php +++ b/public/index.php @@ -139,6 +139,10 @@ if (FILE_CATALOG_FANCY_VIEW && $file_id) { $file['size_formatted'] = sprintf("%.2f", $size / pow(1024, $factor)) . ' ' . $units[$factor]; $file['name'] = $file['title'] ?? sprintf('%s.%s', $file['id'], $file['extension']); + $file['download_name'] = $file['name']; + if (!str_ends_with($file['download_name'], ".{$file['extension']}")) { + $file['download_name'] .= ".{$file['extension']}"; + } $file['resolution'] = []; @@ -249,8 +253,7 @@ $privacy_exists = is_file($_SERVER['DOCUMENT_ROOT'] . '/static/PRIVACY.txt'); - + -- cgit v1.2.3