about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-02-03 18:45:56 +0100
committermultiple creatures <dev@multiple-creature.party>2020-02-21 02:48:02 -0600
commitb2cb81e54fc06361e8597f862e09d4606e30f3dc (patch)
tree9c1042c6bcb726c3fcce03dd7bf9cee50f92e241 /app/models
parent0f5411b7999cfc737aa281f17112d96bbfaa0373 (diff)
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
Diffstat (limited to 'app/models')
-rw-r--r--app/models/concerns/remotable.rb2
1 files changed, 1 insertions, 1 deletions
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