Add form.validate_on_submit for sending uploaded letter

Decided it was better to call this then not. This does rely on
the file_id not being corrupted so the file_id passed
into `uploaded_letter_preview` is valid but am taking that risk
given it should only change if a user is changing the form html.
This commit is contained in:
David McDonald
2019-11-01 10:56:34 +00:00
parent 183c45d523
commit 159d2ff6b2

View File

@@ -202,8 +202,11 @@ def send_uploaded_letter(service_id):
abort(403)
form = LetterUploadPostageForm()
file_id = form.file_id.data
if not form.validate_on_submit():
return uploaded_letter_preview(service_id, file_id)
postage = form.postage.data
metadata = get_letter_metadata(service_id, file_id)
filename = metadata.get('filename')