From c79398ea60a55947a18cd2032f53c45a2fdd8799 Mon Sep 17 00:00:00 2001 From: Matt Davidson Date: Mon, 1 Aug 2016 10:43:06 -0400 Subject: [PATCH] MDL-55246 assign: convert files with spaces If a file is sent to unoconv with a filename that contains spaces, unoconv will fail to produce the intended results. --- lib/filestorage/file_storage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 18e357003b7..a9640e0e99c 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -354,9 +354,9 @@ class file_storage { // Copy the file to the tmp dir. $uniqdir = "core_file/conversions/" . uniqid($file->get_id() . "-", true); $tmp = make_temp_directory($uniqdir); - $localfilename = $file->get_filename(); + $ext = pathinfo($file->get_filename(), PATHINFO_EXTENSION); // Safety. - $localfilename = clean_param($localfilename, PARAM_FILE); + $localfilename = $file->get_id() . '.' . $ext; $filename = $tmp . '/' . $localfilename; try {