MDL-54584 repository: Set a default filename in prepare_file
authorAndrew Nicols <andrew@nicols.co.uk>
Mon, 16 May 2016 03:07:38 +0000 (11:07 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Mon, 16 May 2016 03:07:38 +0000 (11:07 +0800)
repository/lib.php

index f3e8474..297ca6f 100644 (file)
@@ -1617,6 +1617,9 @@ abstract class repository implements cacheable_object {
      * @return file path
      */
     public function prepare_file($filename) {
+        if (empty($filename)) {
+            $filename = 'file';
+        }
         return sprintf('%s/%s', make_request_directory(), $filename);
     }