correct(archive_uploader.rb): considère les archives générées par le DSProxy comme étant déjà analyzées.
This commit is contained in:
parent
9445c12b4d
commit
c6e7c6fa9b
1 changed files with 15 additions and 2 deletions
|
@ -6,7 +6,20 @@ class ArchiveUploader
|
|||
|
||||
def upload(archive)
|
||||
uploaded_blob = create_and_upload_blob
|
||||
archive.file.attach(uploaded_blob)
|
||||
begin
|
||||
archive.file.purge if archive.file.attached?
|
||||
rescue ActiveStorage::FileNotFoundError
|
||||
archive.file.destroy
|
||||
archive.file.detach
|
||||
end
|
||||
archive.reload
|
||||
uploaded_blob.reload
|
||||
ActiveStorage::Attachment.create(
|
||||
name: 'file',
|
||||
record_type: 'Archive',
|
||||
record_id: archive.id,
|
||||
blob_id: uploaded_blob.id
|
||||
)
|
||||
end
|
||||
|
||||
def blob
|
||||
|
@ -56,7 +69,7 @@ class ArchiveUploader
|
|||
key: namespaced_object_key,
|
||||
filename: filename,
|
||||
content_type: 'application/zip',
|
||||
metadata: { virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
metadata: { analyzed: true, virus_scan_result: ActiveStorage::VirusScanner::SAFE }
|
||||
}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue