-
Bug
-
Resolution: Fixed
-
Minor
-
3.1.10, 3.2.7, 3.3.3, 3.4.1
-
MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
-
MOODLE_33_STABLE, MOODLE_34_STABLE
-
MDL-61253-master -
Hello,
One of our clients found a problem and we investigated it.
Problem:
Take a clean Moodle 3.X platform
Add a "File System" repository and configure it correctly
Create a file (not empty) by hand in the repository (moodledata/repository/mydir/myfile. txt)
Create a course.
Add a "folder" activity and in this folder, add a file (myfile.txt) as an alias in the repository.
On the "view. php" page of the folder activity :
If you click on the file, it is well downloaded.
So far everything is working well.
On the other hand, if you decide to download the folder, you get a zip with an empty file.
Explanation:
When you create an alias, you create an empty file that is used as alias in moodledata filedir.
And when you download the folder, it is this file (alias instead of the real file) that is added in the generated zip.
While when downloading the file (when you click on it), the file is well found (you download the real file and not the empty alias)
Code level explanation:
When we download a file, if the file is in a repository, we call a function of this repository and it is this repository that manages the download of the file.
When you add a file to an archive, the archive manager does not take care of the repository and only manages files in the file filedir of Moodle and that's why you get the empty file.
Correction: (for Moodle 3.4)
See corr.diff
Correction limits:
Correction applies ONLY for file system repository, not the others !
I think all other repositories will cause problems
How do you feel about that?
Kind Regards
Olivier