mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-36977 Be more picky when it comes to migrating files in moodle1 backups
This commit is contained in:
parent
7b66137f7b
commit
0ab681d3e7
@ -642,7 +642,9 @@ class moodle1_converter extends base_converter {
|
||||
}
|
||||
foreach ($matches[2] as $match) {
|
||||
$file = str_replace(array('$@FILEPHP@$', '$@SLASH@$', '$@FORCEDOWNLOAD@$'), array('', '/', ''), $match);
|
||||
$files[] = rawurldecode($file);
|
||||
if ($file === clean_param($file, PARAM_PATH)) {
|
||||
$files[] = rawurldecode($file);
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($files);
|
||||
@ -1210,6 +1212,10 @@ class moodle1_file_manager implements loggable {
|
||||
|
||||
$sourcefullpath = $this->basepath.'/'.$sourcepath;
|
||||
|
||||
if ($sourcefullpath !== clean_param($sourcefullpath, PARAM_PATH)) {
|
||||
throw new moodle1_convert_exception('file_invalid_path', $sourcefullpath);
|
||||
}
|
||||
|
||||
if (!is_readable($sourcefullpath)) {
|
||||
throw new moodle1_convert_exception('file_not_readable', $sourcefullpath);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user