From e4f5e9c02996193cc8a6f43684a94a6bf2ca8e15 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 23 Dec 2020 07:47:03 +0100 Subject: [PATCH] Fix trying to privatize empty media attachments (#15414) --- app/services/suspend_account_service.rb | 2 ++ app/services/unsuspend_account_service.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 19d65280d9..22e5197086 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 f07a3f053b..be7ad9df3e 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