mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-09 00:49:07 +08:00
Merge pull request #6385 from okriuchykhin/ok_SCI_9461
Fix file preview generation in projects export jobs [SCI-9461]
This commit is contained in:
commit
8e420181ac
1 changed files with 7 additions and 3 deletions
|
@ -194,13 +194,17 @@ class TeamZipExportJob < ZipExportJob
|
||||||
file_data = preview.image.download
|
file_data = preview.image.download
|
||||||
else
|
else
|
||||||
file_name = preview.blob.filename.to_s
|
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)
|
file_data = preview.processed.service.download(preview.key)
|
||||||
# handle files not processable by Vips (no preview available) or missing
|
# handle files not processable by Vips (no preview available) or missing
|
||||||
rescue Vips::Error, ActiveStorage::FileNotFoundError
|
rescue Vips::Error, ActiveStorage::FileNotFoundError => e
|
||||||
return nil
|
Rails.logger.error(e.message)
|
||||||
|
Rails.logger.error(e.backtrace.join("\n"))
|
||||||
|
raise ActiveRecord::Rollback
|
||||||
end
|
end
|
||||||
|
return nil if file_data.blank?
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue