From 6cd32daccf78b40560b96d5c93a1077831b5daf9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 17 Jun 2022 08:06:37 +0300 Subject: Test endpoint '/parse/parse' * Ensure error messages are displayed if a request is made to the '/parse/parse' endpoint with invalid, or missing data. --- qc_app/parse.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'qc_app') 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")) -- cgit v1.2.3