Merge pull request #6385 from okriuchykhin/ok_SCI_9461

Fix file preview generation in projects export jobs [SCI-9461]
This commit is contained in:
Alex Kriuchykhin 2023-10-09 10:17:25 +02:00 committed by GitHub
commit 8e420181ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -194,13 +194,17 @@ class TeamZipExportJob < ZipExportJob
file_data = preview.image.download
else
file_name = preview.blob.filename.to_s
file_data = nil
begin
ActiveRecord::Base.transaction(requires_new: true) do
file_data = preview.processed.service.download(preview.key)
# handle files not processable by Vips (no preview available) or missing
rescue Vips::Error, ActiveStorage::FileNotFoundError
return nil
rescue Vips::Error, ActiveStorage::FileNotFoundError => e
Rails.logger.error(e.message)
Rails.logger.error(e.backtrace.join("\n"))
raise ActiveRecord::Rollback
end
return nil if file_data.blank?
end
{