diff --git a/lib/form/editor.php b/lib/form/editor.php
index 364f67914ee..294d4925d5e 100644
--- a/lib/form/editor.php
+++ b/lib/form/editor.php
@@ -208,8 +208,16 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
if ($maxfiles != 0 ) {
$str .= '
';
$str .= '';
- $editorurl = "$CFG->wwwroot/repository/filepicker.php?action=browse&env=editor&itemid=$draftitemid&subdirs=$subdirs&maxbytes=$maxbytes&ctx_id=".$ctx->id.'&course='.$PAGE->course->id;
- $str .= html_writer::link($editorurl, get_string('manageeditorfiles'), array('target'=>'_blank'));
+ $editorurl = new moodle_url("$CFG->wwwroot/repository/filepicker.php", array(
+ 'action'=>'browse',
+ 'env'=>'editor',
+ 'itemid'=>$draftitemid,
+ 'subdirs'=>$subdirs,
+ 'maxbytes'=>$maxbytes,
+ 'ctx_id'=>$ctx->id,
+ 'course'=>$PAGE->course->id
+ ));
+ $str .= html_writer::link($editorurl->out(false), get_string('manageeditorfiles'), array('target'=>'_blank'));
//$str .= '';
$str .= '
';
}