-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Currently the download_file() method doesn't check the response code from its call to Bynder with requests.get(). This means that if Bynder returns an error response for any reason, the contents of this response are handled and saved as if they're the image asset expected.
This can then lead to unexpected problems if the error response contains HTML markup: in at least some instances the call to mimetypes.guess_type() incorrectly identifies the stored response as an SVG image. This causes server errors when attempting to create renditions in the image library, or if the 'image' is inserted to a page. See the attached file for an example where this has happened.
Expected behaviour: Error responses are caught and surfaced to content editors with an appropriate message. No asset is stored as a result of failed requests.