-
Bug
-
Resolution: Won't Do
-
Major
-
None
-
2.4.2
-
MOODLE_24_STABLE
While copying a file to your Private Files, if we hack $maxbytes in repository_ajax.php (MDL-36448), then it is possible to upload a file which is greater than $maxbytes but smaller than $CFG->userquota. And this means that any area over Moodle do not respect $CFG->maxbytes properly.
The reason is that in between defining the initial $maxbytes for the File Manager and saving the information in file_save_draft_area_files() there is no check for what should be $maxbytes according to the settings. In repository_ajax.php this check is made by using get_user_max_upload_file_size().
Please note that while fixing this, file references should not be affected by any *bytes limitations (areamaxbytes, maxbytes).
To replicate
- Apply the following to repository_ajax.php
$maxbytes = -1; // get_user_max_upload_file_size($context, $CFG->maxbytes, $coursemaxbytes, $maxbytes);
- Set the setting maxbytes to something small
- Go to your privates files
- Visit Dropbox and upload a file greater than the maxbytes
- Validate the form
Expected
- The file disappears
Actual
- The file is uploaded and accessible in your Private Files
- has been marked as being related by
-
MDL-33445 Inserting a file by reference bypasses the file size limit check
-
- Closed
-
-
MDL-33766 My private files does not properly handle userquota & maxbytes and empty itself
-
- Closed
-
-
MDL-39541 Inconsistency in overwriting and deleting+replacing a file in filemanager
-
- Closed
-
- Testing discovered
-
MDL-36708 file_is_draft_area_limit_reached should not consider references
-
- Closed
-