Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the correct content type for gzipped files with the .gz ext #51

Commits on Mar 8, 2016

  1. 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.
    dannyfallon committed Mar 8, 2016
    Configuration menu
    Copy the full SHA
    5a5abdd View commit details
    Browse the repository at this point in the history