]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10234
authorthepurpleblob <thepurpleblob>
Thu, 28 Jun 2007 15:15:06 +0000 (15:15 +0000)
committerthepurpleblob <thepurpleblob>
Thu, 28 Jun 2007 15:15:06 +0000 (15:15 +0000)
Encoded images in subdirectories failed to load.
Thanks to Enrique Castro for fix.

question/format.php

index 7d00f0852ca2e38ba8457d34a999c44541b9da4e..95f0a74851d33835fba14ee659c8817d73924a25 100644 (file)
@@ -365,6 +365,9 @@ class qformat_default {
         $destination = $path_parts['dirname'];
         $file = clean_filename( $path_parts['basename'] );
 
+        // check if path exists
+        check_dir_exists($destination, true, true );
+
         // detect and fix any filename collision - get unique filename
         $newfiles = resolve_filename_collisions( $destination, array($file) );        
         $newfile = $newfiles[0];
@@ -383,6 +386,7 @@ class qformat_default {
         fclose( $fh );
 
         // return the (possibly) new filename
+        $newfile = ereg_replace("{$CFG->dataroot}/{$this->course->id}/", '',$newfullpath);
         return $newfile;
     }