2019-05-02 11:37:35 +02:00
|
|
|
class VirusScannerJob < ApplicationJob
|
2020-07-13 14:31:21 +02:00
|
|
|
discard_on ActiveRecord::RecordNotFound
|
|
|
|
|
2019-05-02 11:37:35 +02:00
|
|
|
def perform(blob)
|
|
|
|
metadata = extract_metadata_via_virus_scanner(blob)
|
|
|
|
blob.update!(metadata: blob.metadata.merge(metadata))
|
|
|
|
end
|
|
|
|
|
|
|
|
def extract_metadata_via_virus_scanner(blob)
|
|
|
|
ActiveStorage::VirusScanner.new(blob).metadata
|
|
|
|
end
|
|
|
|
end
|