mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Show letter preview once file is uploaded
This shows the sanitised letter preview if the file had no validation errors or the preview with the overlay if it failed validation.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from boto3 import resource
|
||||
from flask import current_app
|
||||
from notifications_utils.s3 import s3upload as utils_s3upload
|
||||
|
||||
@@ -14,3 +15,13 @@ def upload_letter_to_s3(data, file_location, status):
|
||||
file_location=file_location,
|
||||
metadata={'status': status}
|
||||
)
|
||||
|
||||
|
||||
def get_letter_pdf_and_metadata(file_location):
|
||||
s3 = resource('s3')
|
||||
s3_object = s3.Object(current_app.config['TRANSIENT_UPLOADED_LETTERS'], file_location).get()
|
||||
|
||||
pdf = s3_object['Body'].read()
|
||||
metadata = s3_object['Metadata']
|
||||
|
||||
return pdf, metadata
|
||||
|
||||
Reference in New Issue
Block a user