about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2020-12-23 07:47:03 +0100
committerGitHub <noreply@github.com>2020-12-23 15:47:03 +0900
commit473abc35a19771304839dc57dc41ef309a826658 (patch)
treefae91f03390019d05c1562c25cace64d8988e2f4 /app
parent444b21b55ff5768e4cbbaf7cfa8285c65a4b54f9 (diff)
Fix trying to privatize empty media attachments (#15414)
Diffstat (limited to 'app')
-rw-r--r--app/services/suspend_account_service.rb2
-rw-r--r--app/services/unsuspend_account_service.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb
index 19d65280d..22e519708 100644
--- a/app/services/suspend_account_service.rb
+++ b/app/services/suspend_account_service.rb
@@ -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
diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb
index f07a3f053..be7ad9df3 100644
--- a/app/services/unsuspend_account_service.rb
+++ b/app/services/unsuspend_account_service.rb
@@ -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