Permalink
Browse files

MDL-30485 XML import from 1.9 does not handle files in subfolders.

  • Loading branch information...
timhunt committed Nov 28, 2011
1 parent 50ce778 commit ba0f2478be3990575ecd933c78031b37bde35edb
Showing with 3 additions and 2 deletions.
  1. +3 −2 question/format/xml/format.php
@@ -184,9 +184,10 @@ public function import_headers($question) {
$data = new stdClass();
$data->content = $filedata;
$data->encoding = 'base64';
- $data->name = $filename;
+ // Question file areas don't support subdirs, so convert path to filename if necessary.
+ $data->name = clean_param(str_replace('/', '_', $filename), PARAM_FILE);
$qo->questiontextfiles[] = $data;
- $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $filename . '" />';
+ $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $data->name . '" />';
}
// restore files in generalfeedback

0 comments on commit ba0f247

Please sign in to comment.