From 86fbf31120f8b4b5983331de17b0cba10ac25a14 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 8 Apr 2019 23:05:06 +0800 Subject: [PATCH] Fix download a file wasnt exists --- WebMain.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/WebMain.py b/WebMain.py index 7643d58..543d08b 100644 --- a/WebMain.py +++ b/WebMain.py @@ -161,7 +161,10 @@ def fileDownload(path): with open(file, "rb") as f: for row in f: yield row - return Response(generate(path), mimetype='application/octet-stream') + if os.path.exists(path): + return Response(generate(path), mimetype='application/octet-stream') + else: + return Response(status=404) def SubThread():