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
Is your feature request related to a problem? Please describe.
I spent quite some time debugging an issue in our project due to misconfiguration of content_type_mappings - keys were strings instead of symbols.
Describe the solution you'd like
I'd like for content_type_mappings option to be more user-friendly and/or fool-proof. Two options here:
Raise an error when there are string keys provided;
Don't raise any errors and make this option a "hash with indifferent access".
Additional context
This issue was discovered when we tried to upload .json files. Linux file utility returns text/plain content type while content type from extension is application/json. So in order to fix this we had to add a custom mapping:
There was a related issue in the original repo: thoughtbot#2425
I'm happy to provide a PR once we settle on the exact solution: raise or accept both strings and symbols. Plus we could fix the case-sensitivity issue mentioned above as well.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I spent quite some time debugging an issue in our project due to misconfiguration of
content_type_mappings
- keys were strings instead of symbols.Describe the solution you'd like
I'd like for
content_type_mappings
option to be more user-friendly and/or fool-proof. Two options here:Additional context
This issue was discovered when we tried to upload
.json
files. Linuxfile
utility returnstext/plain
content type while content type from extension isapplication/json
. So in order to fix this we had to add a custom mapping:The above code didn't work, because the key is a string, not a symbol. The following code works as expected:
This happens because of this code:
kt-paperclip/lib/paperclip/media_type_spoof_detector.rb
Lines 86 to 88 in f036773
There was a related issue in the original repo: thoughtbot#2425
I'm happy to provide a PR once we settle on the exact solution: raise or accept both strings and symbols. Plus we could fix the case-sensitivity issue mentioned above as well.
The text was updated successfully, but these errors were encountered: