-
Notifications
You must be signed in to change notification settings - Fork 345
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
the content-type of svg image file is crashed after gzip compressing sync to aws #323
Comments
For those who find this later, this seems to be better handled by registering the svg mime type in an initializer:
|
@danielfarrell This didn't work for me when placed in |
I wasn't trying to prevent compression. It should be fine if they are On Friday, April 22, 2016, Matt Coneybeare [email protected] wrote:
|
Nope, I was misidentifying the problem. Was set as txt/plain before and your fix made it work, once my cloudfront copy was invalidated (face-palm)
|
@coneybeare |
So we just register Mime::Type "image/svg+xml" and will not get nil from Mime::Type.lookup_by_extension(ext), right? If true, maybe readme need to append more advanced usage. But I think #322 still have some use for the future, Mime::Type looks have no all of types. |
So what is a preferred API for searching mime type? |
I am not familiar enough in this area to have a strong opinion, but I am generally in favor of things that work "out of the box" without any additional manual configuration additions. |
@coneybeare |
Seems to me the best way to handle this is a PR against that gem to add the missing mime types. Anyone have a list of ones that are commonly issues? |
@danielfarrell
|
I'm seeing the same, my svg files get to cloudfront (AWS CDN) as |
@lloydwatkin Have you tried the suggestion above to register the right mime type for svg? # config/initializers/mime_types.rb
Mime::Type.register "image/svg+xml", :svg Rails recently (5.0) got the above added to the default mime types: rails/rails@7e35cb2 |
Yes but it complained it was already defined and I'm on rails 4 at the @lloydwatkin https://github.com/lloydwatkin Have you tried the suggestion config/initializers/mime_types.rbMime::Type.register "image/svg+xml", :svgRails recently got the above added to the default mime types: rails/rails@ — |
I guess we should let users know they need to put something like |
I found the error due to the content-type is nil from Mime:type.lookup_by_extension(ext), and I fixed it.
#322
The text was updated successfully, but these errors were encountered: