Skip to content

Commit

Permalink
Fix #80 shows a proper error message for empty file request
Browse files Browse the repository at this point in the history
  • Loading branch information
uptoratlen authored Jun 17, 2021
1 parent de2a0c1 commit 3fb015f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ def allowed_file(filename):
def parse_file():
empty_directory("static/chat")

file = request.files['0']
file_req = request.files
if len(file_req) == 0:
response = {
"success": False,
"error_message": "Please upload a file to proceed.",
}
return jsonify(response), 200
file = file_req['0']
if not allowed_file(file.filename):
response = {
"success": False,
Expand Down

0 comments on commit 3fb015f

Please sign in to comment.