You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set the correct content type for gzipped files with the .gz ext
Using the gzip plugin it's possible to specify a `keep` option
which will maintain both the original uncompressed file and save
the gzipped version with a `.gz` suffix. Amazon S3 does not detect
content type or encoding so this is all managed in this plugin via
the mime package. The default mime type is `application/octet-stream`
which is exactly what is detected for a `.gz` files. Uploading
`.js.gz` and `.css.gz` files without their correct content types
blows up some browsers with syntax errors (e.g. Safari)
This PR makes the uploader a little smarter. If we detect a file is
gzipped and has a `.gz` extension we strip the extension and look for
the non-gzipped file in the file path list. If it's found, we'll do
a mime lookup for the non-gzipped file and use _that_ content type
and encoding instead. If a non-gzipped counterpart isn't found we
will still upload the gzipped file as an `application/octet-stream`
so this shouldn't break any valid gzip assets that aren't compressed
as part of the gzip plugin in the pipeline.
0 commit comments