Merge pull request #3218 from alphagov/dev-antivirus-setting

Antivirus off for development by default
This commit is contained in:
David McDonald
2019-12-06 11:49:48 +00:00
committed by GitHub
2 changed files with 7 additions and 3 deletions

View File

@@ -52,9 +52,10 @@ def upload_letter(service_id):
pdf_file_bytes = form.file.data.read()
original_filename = form.file.data.filename
virus_free = antivirus_client.scan(BytesIO(pdf_file_bytes))
if not virus_free:
return invalid_upload_error('Your file contains a virus')
if current_app.config['ANTIVIRUS_ENABLED']:
virus_free = antivirus_client.scan(BytesIO(pdf_file_bytes))
if not virus_free:
return invalid_upload_error('Your file contains a virus')
if len(pdf_file_bytes) > MAX_FILE_UPLOAD_SIZE:
return invalid_upload_error('Your file is too big', 'Files must be smaller than 2MB.')