Send upload_id to Template Preview for logging

This means we can include the anonymous ID for the file in the log
we have about Type3 fonts [1]. Currently, we have no way of tracing
manually uploaded files with this potential defect.

[1]: https://github.com/alphagov/notifications-template-preview/pull/557
This commit is contained in:
Ben Thorner
2021-07-01 12:09:47 +01:00
parent bcc494f0ec
commit 1f33924ceb
4 changed files with 20 additions and 8 deletions

View File

@@ -94,11 +94,12 @@ def get_page_count_for_letter(template, values=None):
return page_count
def sanitise_letter(pdf_file, *, allow_international_letters):
def sanitise_letter(pdf_file, *, upload_id, allow_international_letters):
return requests.post(
'{}/precompiled/sanitise?allow_international_letters={}'.format(
'{}/precompiled/sanitise?allow_international_letters={}&upload_id={}'.format(
current_app.config['TEMPLATE_PREVIEW_API_HOST'],
'true' if allow_international_letters else 'false',
upload_id,
),
data=pdf_file,
headers={'Authorization': 'Token {}'.format(current_app.config['TEMPLATE_PREVIEW_API_KEY'])}