mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Merge pull request #2746 from alphagov/fix-non-content-outside-errors
Undo bug for previewing precompiled letters
This commit is contained in:
@@ -263,7 +263,10 @@ def preview_letter_template_by_notification_id(service_id, notification_id, file
|
||||
if file_type == 'png':
|
||||
try:
|
||||
pdf_page = extract_page_from_pdf(BytesIO(pdf_file), int(page_number) - 1)
|
||||
content = pdf_page if page_is_in_invalid_pages else base64.b64encode(pdf_page).decode('utf-8')
|
||||
if content_outside_printable_area and page_is_in_invalid_pages:
|
||||
content = pdf_page
|
||||
else:
|
||||
content = base64.b64encode(pdf_page).decode('utf-8')
|
||||
except PdfReadError as e:
|
||||
raise InvalidRequest(
|
||||
'Error extracting requested page from PDF file for notification_id {} type {} {}'.format(
|
||||
|
||||
Reference in New Issue
Block a user