about summary refs log tree commit diff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-02-03 18:45:56 +0100
committerGitHub <noreply@github.com>2020-02-03 18:45:56 +0100
commitff07e80533814b8a5a44d9cf376e3ee7ba6b3318 (patch)
tree74d409fdd342fe9178d492b944c20dfe37933ab4 /app/models/concerns
parentc253f5c57e3ad1929c70fb8adb00cb1bc4a2ef5f (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/concerns')
-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