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
master
Eugen Rochko 5 years ago committed by GitHub
parent c253f5c57e
commit ff07e80533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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

Loading…
Cancel
Save