mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-37774 Make moodle1_file_manager::migrate_directory() support trailing slash in rootpath
As the $rootpath is concatenated with the $relpath, we would end with a path like course_files//file.txt. Such a path is detected as not-valid later and an error would be thrown. So the patch makes sure that the trailing slash is cut off.
This commit is contained in:
parent
68c1945a8e
commit
e2f455b8ca
1 changed files with 5 additions and 0 deletions
|
@ -1274,6 +1274,11 @@ class moodle1_file_manager implements loggable {
|
|||
*/
|
||||
public function migrate_directory($rootpath, $relpath='/') {
|
||||
|
||||
// Check the trailing slash in the $rootpath
|
||||
if (substr($rootpath, -1) === '/') {
|
||||
$rootpath = substr($rootpath, 0, strlen($rootpath) - 1);
|
||||
}
|
||||
|
||||
if (!file_exists($this->basepath.'/'.$rootpath.$relpath)) {
|
||||
return array();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue