diff options
author | alpaca-tc <alpaca-tc@alpaca.tc> | 2017-05-06 04:32:14 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-05 21:32:14 +0200 |
commit | ee3e0a93f43d7236928dc2dd63361b69cd7883ee (patch) | |
tree | 64faeff31682318099add4bb7643ef752b769e22 /app/models | |
parent | d1290fbd8f0bbdcef7c0d7eec2b8865ddf9ae804 (diff) |
Fixes unknown mime type (#2822)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/attachmentable.rb | 2 | ||||
-rw-r--r-- | app/models/media_attachment.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/concerns/attachmentable.rb b/app/models/concerns/attachmentable.rb index 995643ada..90ce88463 100644 --- a/app/models/concerns/attachmentable.rb +++ b/app/models/concerns/attachmentable.rb @@ -15,7 +15,7 @@ module Attachmentable next if attachment.blank? extension = Paperclip::Interpolations.content_type_extension(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 diff --git a/app/models/media_attachment.rb b/app/models/media_attachment.rb index 1613346ff..d18ebabd4 100644 --- a/app/models/media_attachment.rb +++ b/app/models/media_attachment.rb @@ -128,7 +128,7 @@ class MediaAttachment < ApplicationRecord self.type = VIDEO_MIME_TYPES.include?(file_content_type) ? :video : :image extension = appropriate_extension 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 def set_meta |