fix failed sanitise flow

the move from virus scan to validation failed function was called with
the wrong variables, and had some internal logic that was slightly
wrong.

Also, Don't use `update_notification_by_id` for notifications if they
are not in `created`, `sending`, `pending`, or `sent`. It silently
doesn't update them. I didn't want to do a deeper investigation into
the reasons behind this terrifying state machine as part of this commit
so I just changed the functions to call `dao_update_notification`
manually
This commit is contained in:
Leo Hemsted
2018-10-16 17:20:34 +01:00
parent 9606513e1f
commit 7bf68e3664
3 changed files with 61 additions and 12 deletions

View File

@@ -108,9 +108,9 @@ def move_error_pdf_to_scan_bucket(source_filename):
def move_scan_to_invalid_pdf_bucket(source_filename):
scan_bucket = current_app.config['LETTERS_SCAN_BUCKET_NAME']
invalid_pdf_bucket = current_app.config['INVALID_PDF_BUCKET_NAME']
invalid_pdf = source_filename
_move_s3_object(invalid_pdf_bucket, invalid_pdf, invalid_pdf_bucket, source_filename)
_move_s3_object(scan_bucket, source_filename, invalid_pdf_bucket, source_filename)
def get_file_names_from_error_bucket():