Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-39541

Inconsistency in overwriting and deleting+replacing a file in filemanager

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.4.3
    • Fix Version/s: None
    • Component/s: Filepicker, Files API
    • Labels:
    • Affected Branches:
      MOODLE_24_STABLE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                marina Marina Glancy
                Reporter:
                marina Marina Glancy
                Participants:
                Component watchers:
                Adrian Greeve, Mihail Geshoski, Peter Dias, Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: