-
Bug
-
Resolution: Fixed
-
Major
-
4.2.6, 4.3.3
We have found that, in our Moodle site, occasionally, files are getting uploaded with filepath set to '/undefined/' when it should probably be '/'.
Given that 'undefined' is a thing in JavaScript, this looks like an intermittent but in the FilePicker code.
If the place being uploaded to is set to not allow subdirectories, then this leads to the file being lost.
When I say itermittent, on our Moodle site we have had 458931 file upload attempts this year, of which 147 (0.032%) had this problem. So, it is very itermittent, but we found this because one of the lost files was in an exam submission, and that sort of thing makes you worry.
Some useful queries:
Problem files that got as far as the files table.
SELECT component, COUNT(1) |
FROM mdl_files |
WHERE filepath = '/undefined/' |
GROUP BY component |
ORDER BY count(1) DESC |
Logs of uploads that went wrong like this:
SELECT TO_TIMESTAMP(timecreated), * |
FROM mdl_logstore_standard_log |
WHERE eventname = '\core\event\draft_file_added' |
AND other::json->>'filepath' = '/undefined/' |
ORDER BY timecreated DESC |
Daily count of successful and failed uploads.
SELECT DATE_TRUNC('day', TO_TIMESTAMP(timecreated)), COUNT(1), COUNT(other::json->>'filepath' = '/undefined/' OR NULL) |
FROM mdl_logstore_standard_log |
WHERE eventname = '\core\event\draft_file_added' |
GROUP BY DATE_TRUNC('day', TO_TIMESTAMP(timecreated)) |
ORDER BY DATE_TRUNC('day', TO_TIMESTAMP(timecreated)) |
The last two might be Postgres-specific.
Note that, when this happens, the log entry contains the contenthash of the file that was uploaded, and that file can probalby be retrieved from Moodle's file pool.
- has a non-specific relationship to
-
MDL-21784 Adding forumintro file (upload) creates 3 records in mdl_files table
-
- Closed
-