Virus handling is added to AttachFilesToWorkJob (which unfortunately must be
copied wholesale from Hyrax).
By default Hyrax embeds virus checking in the model validations, which means a
real Hydra::PCDM::File must exist in order to check for a virus and handle
errors. This is somewhat challenging in the case that we want to check
asynchonously and handle errors, since a File doesn't exist until an
ImportJob is running; in the default actor stack, this is several asynchonous
jobs deep.
By adding an early check, we can avoid creating a FileSet for files that
contain a virus, and add error handling earlier in the stack. In this case, we
log to Rails.logger.error.
We also clean up the file from disk, which Hyrax does not seem to bother
with(?).
Coverage decreased (-0.05%) to 98.158% when pulling b0e97638ed7a3c0047bcff7e57f010e8549d4d7f on basic-virus-checking into 8003c4a38d442ba72d2d408a3b6f5670c842402b on master.
Virus handling is added to
AttachFilesToWorkJob
(which unfortunately must be copied wholesale from Hyrax).By default Hyrax embeds virus checking in the model validations, which means a real
Hydra::PCDM::File
must exist in order to check for a virus and handle errors. This is somewhat challenging in the case that we want to check asynchonously and handle errors, since aFile
doesn't exist until anImportJob
is running; in the default actor stack, this is several asynchonous jobs deep.By adding an early check, we can avoid creating a
FileSet
for files that contain a virus, and add error handling earlier in the stack. In this case, we log toRails.logger.error
.We also clean up the file from disk, which Hyrax does not seem to bother with(?).
Closes #178.