]> cat aescling's git repositories - mastodon.git/commitdiff
Fix file names being obfuscated on update when file didn't change (#12857)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 13 Jan 2020 11:54:33 +0000 (12:54 +0100)
committerGitHub <noreply@github.com>
Mon, 13 Jan 2020 11:54:33 +0000 (12:54 +0100)
Fix #12849

app/models/concerns/attachmentable.rb

index 1e8c4806f676377f3d6ed35ec01b8610766d17ce..43ff8ac12e042ea41b649c3649e720707a0c2b50 100644 (file)
@@ -74,7 +74,7 @@ module Attachmentable
     self.class.attachment_definitions.each_key do |attachment_name|
       attachment = send(attachment_name)
 
-      next if attachment.blank?
+      next if attachment.blank? || attachment.queued_for_write[:original].blank?
 
       attachment.instance_write :file_name, SecureRandom.hex(8) + File.extname(attachment.instance_read(:file_name))
     end