-
Bug
-
Resolution: Duplicate
-
Critical
-
None
-
2.4.3
-
MOODLE_24_STABLE
Imagine having a file in filearea (i.e. Private or course files) that is a source of reference.
When user edits the filearea it is dispayed with "source" icon, when user clicks on the file he can see the list of files linking to it
User is able to override the file by uploading/picking/drag&dropping another file, saving it with the same name and choosing "Overwrite" in the popup.
Visual problem here: if user refreshes the filemanager view, he can no longer see that file is a source of a reference, although it is (SLIGHTLY BAD)
After the filearea is saved, all links are updated.
Now: when user deletes this file he gets a warning that all links will be converted to true copies. User agrees.
Then user uploads the file with the same name.
The new file (in the draft filearea) is not shown as the source of link.
But when user saves the filearea the new file magically replaces the old file and all links now point to it, they are not converted into true copies as the warning said. (VERY BAD)
Also code of function file_save_draft_area_files() is just terrible, with a lot of repetitions and because of that maxbytes check is not applied when overriding files.
And another thing I've noticed (but we may create another issue about it): At the moment files included by reference may be bigger than 'maxbytes' for the area. But when the source (located in another filearea) is deleted the references are converted to true copies automatically and no maxbytes check is performed on their areas.