Extract zip: Ignore content type and check extension
It appears that zip
archives from Windows sometimes come with content type application/x-zip-compressed
. In that case, the user cannot unzip the archive because we check for application/zip
only:
{"error":"Incompatible content type for extracting: application/x-zip-compressed","localizedError":"Incompatible content type for extracting: application/x-zip-compressed"}
This MR changes the first test to inspect only that file.extension == '.zip'
(before loading bytes) and then wraps the unzipping operation in a try () { }
block.
Edited by Matija Obreza