mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Add new tasks for sanitising precompiled letters
Added a task, `sanitise-letter`, that will be called from antivirus when a letter has passed virus scan. This calls a new task in template-preview which will sanitise the PDF. A second new task, `process-sanitised-letter`, will be called from the template preview task and deals with updating the notification and moving it to the relevant bucket.
This commit is contained in:
@@ -156,6 +156,19 @@ def move_uploaded_pdf_to_letters_bucket(source_filename, upload_filename):
|
||||
)
|
||||
|
||||
|
||||
def move_sanitised_letter_to_test_or_live_pdf_bucket(filename, is_test_letter, created_at):
|
||||
target_bucket_config = 'TEST_LETTERS_BUCKET_NAME' if is_test_letter else 'LETTERS_PDF_BUCKET_NAME'
|
||||
target_bucket_name = current_app.config[target_bucket_config]
|
||||
target_filename = get_folder_name(created_at, dont_use_sending_date=is_test_letter) + filename
|
||||
|
||||
_move_s3_object(
|
||||
source_bucket=current_app.config['LETTER_SANITISE_BUCKET_NAME'],
|
||||
source_filename=filename,
|
||||
target_bucket=target_bucket_name,
|
||||
target_filename=target_filename,
|
||||
)
|
||||
|
||||
|
||||
def get_file_names_from_error_bucket():
|
||||
s3 = boto3.resource('s3')
|
||||
scan_bucket = current_app.config['LETTERS_SCAN_BUCKET_NAME']
|
||||
|
||||
Reference in New Issue
Block a user