From 2012a19efa50e2d71ad2b08a5b974dc8f97666d6 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 15 Feb 2018 17:03:15 +0100 Subject: [PATCH] Disable content type detection for new attachments --- config/initializers/monkey_patches.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 config/initializers/monkey_patches.rb diff --git a/config/initializers/monkey_patches.rb b/config/initializers/monkey_patches.rb new file mode 100644 index 000000000..5c82ece93 --- /dev/null +++ b/config/initializers/monkey_patches.rb @@ -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