From db8efa6d924da97cd6fcba87bdd810083b03fae2 Mon Sep 17 00:00:00 2001 From: Nexterday Date: Tue, 10 Sep 2024 14:57:16 +0200 Subject: [PATCH] Fixes #3 --- report.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/report.php b/report.php index b1c2486..774702f 100644 --- a/report.php +++ b/report.php @@ -323,7 +323,8 @@ protected function filedownloader_process_files($course, $quiz, $cmid, $attempts $filename = preg_replace('/[^a-zA-Z0-9.]/', '_', $file->get_filename()); $filename = preg_replace('/_+/', '_', $filename); if (strlen($filename) > 30) { - $filename = substr($filename, 0, 30) . '.zip'; + $fileext = '.' . substr($filename, strrpos($filename, '.') + 1); + $filename = substr($filename, 0, 30) . $fileext; } $pathname = clean_param($path[0] . $path[1] . $path[2] . $path[3] . $filename, PARAM_PATH); $zipcontent[$pathname] = $file;