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

mod_folder download a file of 0ko when file is an alias

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.2.4
    • Fix Version/s: None
    • Component/s: Files API
    • Labels:
      None
    • Affected Branches:
      MOODLE_32_STABLE

      Description

      When a file is added as an alias in a folder module, the downloading of the folder create a zip archive with an empty text file of 0ko having the name of the original (consistent) file.

      I've seen in MDL-44066 that a similar problem happend for the restoration of a course where the SCORMs were added using an alias.

      I've done a bit of research and it seams that the problem is eiter

      • the use of $fs->get_file(...) in mod/folder/download_folder.php versus $fs->get_area_files(...) in mod/resource/view.php
      • the function get_directory_files(...) declared in lib/filestorage/file_storage.php and called in lib/filestorage/zip_packer.php in the function archive_stored(...)

      I've tried to get the right file using the mdl_files.referencefileid field (looking in the mdl_file_reference table for matching id) but I didn't see a right way to do it with the moodle file API.

      I feel like the best way to fix that bug is to change the function get_directory_files() and make it return also the original content of an alias file but I am not aware of all the consequences that this modification can create.

      Could you, dear moodler, explain your point of view on the proposed solutions or give another one ?

      Have a nice day,
      Guillaume

        Attachments

          Activity

            People

            • Assignee:
              tazoeur Guillaume Latour
              Reporter:
              tazoeur Guillaume Latour
              Participants:
              Component watchers:
              Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: