Tim Hunt adf336cbf2 MDL-82177 file upload: default to path '/'when things go wrong
This 'fix' is basically a work-around, but one that is already used in
some places. Now it is used in all similar places.

Exactly what causes the current file path in a file manager to become
unset is still unclear to me, but it seems to be an obscure race
condition that is very hard to reproduce.

However, when it happens, currently we are effectively defaulting to
path '/undefined/'. Using '/' is never worse, and is infinitely better
in the case where the filepicker does not allow folders to be used
(which includes important cases like essay questions in a quiz, which
some people use for exams!). In that case, falling back to non-top-level
path leads to dataloss.

Also, this is all historic JavaScript which will get replaced in the
grand de-YUI-fication, so I think a pragmatic fix is justified here.
2024-07-30 15:07:02 +01:00
..