Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit ba0f2478be3990575ecd933c78031b37bde35edb 1 parent 50ce778
@timhunt timhunt authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 question/format/xml/format.php
View
5 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
Please sign in to comment.
Something went wrong with that request. Please try again.