Scan files with clamdscan #77

Merged
Anna Sirota merged 17 commits from scan-file into main 2024-04-12 19:11:30 +02:00
Showing only changes of commit 21b74c28af - Show all commits

View File

@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
@background(schedule={'action': TaskSchedule.RESCHEDULE_EXISTING}) @background(schedule={'action': TaskSchedule.RESCHEDULE_EXISTING})
def scan(file_id: int): def scan(file_id: int):
"""Run a scan on a given file and save its output as a FileValidation record.""" """Run a scan of a given file and save its output as a FileValidation record."""
file = files.models.File.objects.get(pk=file_id) file = files.models.File.objects.get(pk=file_id)
abs_path = os.path.join(settings.MEDIA_ROOT, file.source.path) abs_path = os.path.join(settings.MEDIA_ROOT, file.source.path)
completed_process = files.utils.run_clamdscan(abs_path) completed_process = files.utils.run_clamdscan(abs_path)