Skip to content

Commit

Permalink
Fix remote convertible media attachments not being saved (#13032)
Browse files Browse the repository at this point in the history
Because the file name was set after loading the file, Paperclip
was flagging the differing file extension as content type spoofing

Fix #12938
  • Loading branch information
Gargron committed Feb 3, 2020
1 parent c253f5c commit ff07e80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/concerns/remotable.rb
Expand Up @@ -36,8 +36,8 @@ def remotable_attachment(attachment_name, limit, suppress_errors: true)

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
Expand Down

0 comments on commit ff07e80

Please sign in to comment.