mirror of
https://github.com/kemko/paperclip.git
synced 2026-01-01 16:05:40 +03:00
Не перегружаем все стили в S3, если это SVG
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user