diff --git a/lib/paperclip/attachment.rb b/lib/paperclip/attachment.rb index 4d06464..dc5a418 100644 --- a/lib/paperclip/attachment.rb +++ b/lib/paperclip/attachment.rb @@ -414,7 +414,7 @@ module Paperclip end def post_process #:nodoc: - return if !content_type.include?('image') || content_type.include?('svg') + return unless subject_to_post_process? return if queued_for_write[:original].nil? instance.run_paperclip_callbacks(:post_process) do @@ -473,5 +473,9 @@ module Paperclip file.write(body) file.tap(&:flush).tap(&:rewind) end + + def subject_to_post_process? + content_type.include?('image') && !content_type.include?('svg') + end end end diff --git a/lib/paperclip/storage/no_cache_s3.rb b/lib/paperclip/storage/no_cache_s3.rb index 5177002..6a73e0d 100644 --- a/lib/paperclip/storage/no_cache_s3.rb +++ b/lib/paperclip/storage/no_cache_s3.rb @@ -159,7 +159,7 @@ module Paperclip return unless instance.respond_to?(synced_field_name) return true if instance.public_send(synced_field_name) - styles_to_upload = content_type.include?('image') ? self.class.all_styles : [:original] + styles_to_upload = subject_to_post_process? ? self.class.all_styles : [:original] files ||= styles_to_upload.each_with_object({}) do |style, result| file = to_file(style, self.class.main_store_id) # For easier monitoring