From: Eugen Rochko Date: Mon, 3 Feb 2020 17:45:56 +0000 (+0100) Subject: Fix remote convertible media attachments not being saved (#13032) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=ff07e80533814b8a5a44d9cf376e3ee7ba6b3318;p=mastodon.git Fix remote convertible media attachments not being saved (#13032) Because the file name was set after loading the file, Paperclip was flagging the differing file extension as content type spoofing Fix #12938 --- diff --git a/app/models/concerns/remotable.rb b/app/models/concerns/remotable.rb index b7a476c87..c728a460e 100644 --- a/app/models/concerns/remotable.rb +++ b/app/models/concerns/remotable.rb @@ -36,8 +36,8 @@ module Remotable basename = SecureRandom.hex(8) - send("#{attachment_name}=", StringIO.new(response.body_with_limit(limit))) send("#{attachment_name}_file_name=", basename + extname) + send("#{attachment_name}=", StringIO.new(response.body_with_limit(limit))) self[attribute_name] = url if has_attribute?(attribute_name) end