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

Repositories should use send_file_not_found instead exceptions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.5.3
    • Fix Version/s: None
    • Component/s: Repositories
    • Labels:
    • Affected Branches:
      MOODLE_35_STABLE

      Description

      Repositories like onedrive or googledocs should stop throwing exceptions (especially in the send_file() method) and use sent_file_not_found() method (like it is done by other repositories).

      Right now, an exception does not come with a 404 error so external clients doing downloads (via webservice/pluginfile) will receive a 200 code message and the exception message as the file contents.

      send_file_not_found() is the right approach because:

      • It sends a 404 (Not found) error, so any download by an external client will understand that the download failed
      • It also includes an exception message
      • It supports CORS

      I'm not sure what's the best approach to implement this, maybe we should just wrap in a try / catch webservice/pluginfile.php and process the exception there?

        Attachments

          Activity

            People

            • Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Participants:
              Component watchers:
              Adrian Greeve, Mihail Geshoski, Peter Dias
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: