]> cat aescling's git repositories - mastodon.git/commitdiff
Fix trying to privatize empty media attachments (#15414)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 23 Dec 2020 06:47:03 +0000 (07:47 +0100)
committerGitHub <noreply@github.com>
Wed, 23 Dec 2020 06:47:03 +0000 (15:47 +0900)
app/services/suspend_account_service.rb
app/services/unsuspend_account_service.rb

index 19d65280d97b7be52f6d10dcb6f3122c3464410e..22e51970860eda1bb9d4d768c8a7d5c1e1c6e919 100644 (file)
@@ -65,6 +65,8 @@ class SuspendAccountService < BaseService
         attachment = media_attachment.public_send(attachment_name)
         styles     = [:original] | attachment.styles.keys
 
+        next if attachment.blank?
+
         styles.each do |style|
           case Paperclip::Attachment.default_options[:storage]
           when :s3
index f07a3f053b4c07fdbae2899f4a80dbd30e048a5f..be7ad9df3e4e361340cb824f6879b4066771f7d1 100644 (file)
@@ -56,6 +56,8 @@ class UnsuspendAccountService < BaseService
         attachment = media_attachment.public_send(attachment_name)
         styles     = [:original] | attachment.styles.keys
 
+        next if attachment.blank?
+
         styles.each do |style|
           case Paperclip::Attachment.default_options[:storage]
           when :s3