Fixes unknown mime type (#2822)
parent
d1290fbd8f
commit
ee3e0a93f4
|
@ -15,7 +15,7 @@ module Attachmentable
|
||||||
next if attachment.blank?
|
next if attachment.blank?
|
||||||
extension = Paperclip::Interpolations.content_type_extension(attachment, :original)
|
extension = Paperclip::Interpolations.content_type_extension(attachment, :original)
|
||||||
basename = Paperclip::Interpolations.basename(attachment, :original)
|
basename = Paperclip::Interpolations.basename(attachment, :original)
|
||||||
attachment.instance_write :file_name, [basename, extension].delete_if(&:empty?).join('.')
|
attachment.instance_write :file_name, [basename, extension].delete_if(&:blank?).join('.')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ class MediaAttachment < ApplicationRecord
|
||||||
self.type = VIDEO_MIME_TYPES.include?(file_content_type) ? :video : :image
|
self.type = VIDEO_MIME_TYPES.include?(file_content_type) ? :video : :image
|
||||||
extension = appropriate_extension
|
extension = appropriate_extension
|
||||||
basename = Paperclip::Interpolations.basename(file, :original)
|
basename = Paperclip::Interpolations.basename(file, :original)
|
||||||
file.instance_write :file_name, [basename, extension].delete_if(&:empty?).join('.')
|
file.instance_write :file_name, [basename, extension].delete_if(&:blank?).join('.')
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_meta
|
def set_meta
|
||||||
|
|
|
@ -4,7 +4,7 @@ Paperclip.options[:read_timeout] = 60
|
||||||
|
|
||||||
Paperclip.interpolates :filename do |attachment, style|
|
Paperclip.interpolates :filename do |attachment, style|
|
||||||
return attachment.original_filename if style == :original
|
return attachment.original_filename if style == :original
|
||||||
[basename(attachment, style), extension(attachment, style)].delete_if(&:empty?).join('.')
|
[basename(attachment, style), extension(attachment, style)].delete_if(&:blank?).join('.')
|
||||||
end
|
end
|
||||||
|
|
||||||
if ENV['S3_ENABLED'] == 'true'
|
if ENV['S3_ENABLED'] == 'true'
|
||||||
|
|
Loading…
Reference in New Issue