Merge pull request #1444 from betagouv/cellar_monkey_patch_range

Disable content type detection for new attachments
This commit is contained in:
Mathieu Magnin 2018-02-15 17:15:25 +01:00 committed by GitHub
commit d02ae00c0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,9 @@
ActiveStorage::Identification.class_eval do
def apply
# Monkey patch ActiveStorage to trust the user-submitted content type rather than determining
# it from the file contents, because Cellar does not seem to support the Range header
#
# FIXME : remove when better fix is available
blob.update!(content_type: declared_content_type, identified: true) unless blob.identified?
end
end