Fix trying to privatize empty media attachments (#15414)

This commit is contained in:
Eugen Rochko 2020-12-23 07:47:03 +01:00 committed by GitHub
parent 444b21b55f
commit 473abc35a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,8 @@ class SuspendAccountService < BaseService
attachment = media_attachment.public_send(attachment_name) attachment = media_attachment.public_send(attachment_name)
styles = [:original] | attachment.styles.keys styles = [:original] | attachment.styles.keys
next if attachment.blank?
styles.each do |style| styles.each do |style|
case Paperclip::Attachment.default_options[:storage] case Paperclip::Attachment.default_options[:storage]
when :s3 when :s3

View File

@ -56,6 +56,8 @@ class UnsuspendAccountService < BaseService
attachment = media_attachment.public_send(attachment_name) attachment = media_attachment.public_send(attachment_name)
styles = [:original] | attachment.styles.keys styles = [:original] | attachment.styles.keys
next if attachment.blank?
styles.each do |style| styles.each do |style|
case Paperclip::Attachment.default_options[:storage] case Paperclip::Attachment.default_options[:storage]
when :s3 when :s3