about summary refs log tree commit diff
path: root/qc_app
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-06-17 08:06:37 +0300
committerFrederick Muriuki Muriithi2022-06-17 08:06:37 +0300
commit6cd32daccf78b40560b96d5c93a1077831b5daf9 (patch)
tree01a657c21f821536e3a137fbc3a717b2d83dc4bc /qc_app
parentc6b182d346dcf6d3b1cb98956aa3066067f00757 (diff)
downloadgn-uploader-6cd32daccf78b40560b96d5c93a1077831b5daf9.tar.gz
Test endpoint '/parse/parse'
* Ensure error messages are displayed if a request is made to the
  '/parse/parse' endpoint with invalid, or missing data.
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/parse.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/qc_app/parse.py b/qc_app/parse.py
index e72a163..fa3c8cd 100644
--- a/qc_app/parse.py
+++ b/qc_app/parse.py
@@ -30,10 +30,11 @@ def parse():
         flash("Invalid filetype provided", "alert-error")
         errors = True
 
-    filepath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
-    if not os.path.exists(filepath):
-        flash("Selected file does not exist (any longer)", "alert-danger")
-        errors = True
+    if filename:
+        filepath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
+        if not os.path.exists(filepath):
+            flash("Selected file does not exist (any longer)", "alert-error")
+            errors = True
 
     if errors:
         return redirect(url_for("entry.upload_file"))