Skip to content

Commit

Permalink
Merge pull request #1773 from openzim/ignore-s3-web-mime-type
Browse files Browse the repository at this point in the history
Ignore (wrong) webp mime-type from S3
  • Loading branch information
kelson42 authored Feb 9, 2023
2 parents 2b7d233 + c31cd31 commit 3498510
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,17 @@ class Downloader {
}
const mwResp = await axios(url, this.arrayBufferRequestOptions)

/* TODO: Code to remove in a few months (February 2023). For
some reason, it seems a few pictures have 'image/webp'
mime-type in S3 although they are png, ... This leads to
having the following code not assuming they should be
converted to wepb. To avoid this, as a temporary solution,
such scneario are ignored and mime-type definition relies
only on url and Mediawiki header. */
if (s3Resp?.Metadata?.contenttype === 'image/webp') {
s3Resp.Metadata.contenttype = undefined
}

// sanitize Content-Type
mwResp.headers['content-type'] = getMimeType(url, s3Resp?.Metadata?.contenttype || mwResp.headers['content-type'])

Expand Down

0 comments on commit 3498510

Please sign in to comment.