MDL-64220 privacy: Clean path params

We need to consistently clean the path params before we use them. This
shows a difference on windows where dir separators are different.
This commit is contained in:
Damyon Wiese
2018-11-27 15:01:41 +08:00
parent 0225ad42ea
commit ff015b5f7a
@@ -453,7 +453,7 @@ class moodle_content_writer implements content_writer {
$this->write_data($newshortpath, $variablecontent);
} else {
$treekey[$shortpath] = 'No var';
$treekey[clean_param($shortpath, PARAM_PATH)] = 'No var';
}
}
return [$tree, $treekey, $allfiles];
@@ -488,11 +488,11 @@ class moodle_content_writer implements content_writer {
$url = clean_param($url, PARAM_PATH);
$treeleaf->name = $file;
$treeleaf->itemtype = 'item';
$gokey = $url . DIRECTORY_SEPARATOR . $file;
$gokey = clean_param($url . '/' . $file, PARAM_PATH);
if (isset($treekey[$gokey]) && $treekey[$gokey] !== 'No var') {
$treeleaf->datavar = $treekey[$gokey];
} else {
$treeleaf->url = new \moodle_url($url . DIRECTORY_SEPARATOR . $file);
$treeleaf->url = new \moodle_url($url . '/' . $file);
}
};