From 4132731ce97cec5353c7c23bfda7f59c81e153b8 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Fri, 31 Aug 2018 18:46:34 +0530 Subject: [PATCH] Fixes #3758 checks file value before accessing it Now we check if there is any uploaded file in the request object before accessing it. This was causing error if the 'fh' key was missing in the request.files. --- securedrop/source_app/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/securedrop/source_app/main.py b/securedrop/source_app/main.py index 40aeab55ad..cd52fe42f8 100644 --- a/securedrop/source_app/main.py +++ b/securedrop/source_app/main.py @@ -124,7 +124,9 @@ def lookup(): @login_required def submit(): msg = request.form['msg'] - fh = request.files['fh'] + fh = None + if 'fh' in request.files: + fh = request.files['fh'] # Don't submit anything if it was an "empty" submission. #878 if not (msg or fh):