-
Bug
-
Resolution: Fixed
-
Major
-
3.4.3
-
MOODLE_34_STABLE
-
MOODLE_34_STABLE, MOODLE_35_STABLE
-
MDL-62849-master -
- When a filemanager is configured to allow subdirs and restrictions are added to the accepted file types, the filemanager does not permit to add or manage files with folders.
- we are working on a plugin that uses this functionality and it stopped working when we upgraded to Moodle 3.4, I included the plugin in a .zip file.
STEPS TO REPLICATE WITH THE PLUGIN "Theme assets":
1. Go to Site administration > Appearance > Theme assets
2. Click the create a folder button.
3. Provide a name for the new folder and click the Create folder button.
4. Open the new folder.
5. Upload a file that is of an accepted file type such as .png.
6. Click the Save changes button.
OBSERVED BEHAVIOR:
Receive error stating, "Some files (.) cannot be uploaded. Only file types web_file, web_image are allowed." If you navigate away from the theme assets tool and return to the tool you will observe that the new folder and file were not saved.
EXPECTED BEHAVIOR:
New folder and file are saved without any errors.
FURTHER INVESTIGATION:
- Using a filemanager I created a folder (Folder 10) and uploaded an image inside it (File 2), I also uploaded an image (File 1) at the same "level" of the folder.
- then I included "print_object($draftfiles)" in the function "validateSubmitValue" on line 337, the result that I obtained was the following:
-
stdClass Object
(
[path] => Array
(
[0] => Array
(
[name] => Files
[path] => /
)
)
[itemid] => 480128757
[list] => Array
(
[0] => stdClass Object
(
[filename] => .
[filepath] => /Folder 10/
[fullname] => Folder 10
[size] =>
[filesize] => 0
[sortorder] => 0
[author] =>
[license] =>
[datemodified] => 1530632387
[datecreated] => 1530632387
[isref] =>
[icon] => http://moodle.test/theme/image.php/snap/core/1530317540/f/folder
[type] => folder
[thumbnail] => http://moodle.test/theme/image.php/snap/core/1530317540/f/folder
)
[1] => stdClass Object
(
[filename] => File 1.png
[filepath] => /
[fullname] => File 1.png
[size] => 125063
[filesize] => 122.1KB
[sortorder] => 0
[author] => Moodlerooms Support
[license] => allrightsreserved
[datemodified] => 1530632398
[datecreated] => 1530632398
[isref] =>
[mimetype] => Image (PNG)
[type] => file
[url] => http://moodle.test/draftfile.php/2425/user/draft/480128757/File%201.png
[icon] => http://moodle.test/theme/image.php/snap/core/1530317540/f/png
[thumbnail] => http://moodle.test/theme/image.php/snap/core/1530317540/f/png
[status] => 0
[realthumbnail] => http://moodle.test/draftfile.php/2425/user/draft/480128757/File%201.png?preview=thumb&oid=1530632398
[realicon] => http://moodle.test/draftfile.php/2425/user/draft/480128757/File%201.png?preview=tinyicon&oid=1530632398
[image_width] => 3316
[image_height] => 1544
)
)
)
- It seems that the function "file_get_drafarea_files" is not returning the files inside the folder.