From 717357948e0be31289025f1902c791a4f726e6c7 Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Thu, 28 Jun 2007 15:15:06 +0000 Subject: [PATCH] MDL-10234 Encoded images in subdirectories failed to load. Thanks to Enrique Castro for fix. --- question/format.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/question/format.php b/question/format.php index 7d00f0852..95f0a7485 100644 --- a/question/format.php +++ b/question/format.php @@ -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; } -- 2.11.4.GIT