mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 15:46:07 -05:00
Fix the filenames for international precompiled letters
We were determing the filename for precompiled letters before we had checked if the letters were international. This meant that a letter could have a filename indicating it was 2nd class, but once we had sanitised the letter and checked the address we were setting the notification to international. This stopped these letters from being picked up to be sent to the DVLA, since the filename and postage of the letter did not match. We now regenerate the filename after the letter has been sanitised (and when we know the postage) and use the updated filename when moving the letter into the live PDF letters bucket.
This commit is contained in:
@@ -148,10 +148,10 @@ 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):
|
||||
def move_sanitised_letter_to_test_or_live_pdf_bucket(filename, is_test_letter, created_at, new_filename):
|
||||
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
|
||||
target_filename = get_folder_name(created_at, dont_use_sending_date=is_test_letter) + new_filename
|
||||
|
||||
_move_s3_object(
|
||||
source_bucket=current_app.config['LETTER_SANITISE_BUCKET_NAME'],
|
||||
|
||||
Reference in New Issue
Block a user