From ff07e80533814b8a5a44d9cf376e3ee7ba6b3318 Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Mon, 3 Feb 2020 18:45:56 +0100
Subject: [PATCH] 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
---
app/models/concerns/remotable.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/concerns/remotable.rb b/app/models/concerns/remotable.rb
index b7a476c87a..c728a460e5 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
--
GitLab