lib/lockbox/active_storage_extensions.rb in lockbox-1.4.0 vs lib/lockbox/active_storage_extensions.rb in lockbox-1.4.1

- old
+ new

@@ -122,10 +122,17 @@ def preview(*args) raise Lockbox::Error, "Preview not supported for encrypted files" if Utils.encrypted_options(record, name) super end + if ActiveStorage::VERSION::STRING.to_f == 7.1 && ActiveStorage.version >= "7.1.4" + def transform_variants_later + blob.instance_variable_set(:@lockbox_encrypted, true) if Utils.encrypted_options(record, name) + super + end + end + if ActiveStorage::VERSION::MAJOR >= 6 def open(**options) blob.open(**options) do |file| options = Utils.encrypted_options(record, name) # only trust the metadata when migrating @@ -148,9 +155,15 @@ end end end module Blob + if ActiveStorage::VERSION::STRING.to_f == 7.1 && ActiveStorage.version >= "7.1.4" + def preview_image_needed_before_processing_variants? + !instance_variable_defined?(:@lockbox_encrypted) && super + end + end + private def extract_content_type(io) if io.is_a?(Lockbox::IO) && io.extracted_content_type io.extracted_content_type