-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base moodle's file_exist method on the file content instead of headers
In moodle we can't make a API call to check if a file exists and we have to rely on the URL where file will be downloaded. When a problem occurs we get a 200 response with a JSON document with the reason of the error. We don't want to always download the document as it will actually download the full PDF file for success cases, the most common case. Until now we been relying on the headers of a HEAD HTTP request, interpreting JSON responses as the file being missing. We have found at least one school that doesn't include the content-type header on the response so he are switch the approach to inspect the first bytes of the response and check if we are getting a PDF back from Moodle.
- Loading branch information
Showing
2 changed files
with
16 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters