From b00ca28678d04228464841f15bc87e4a767eb8c4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20T=C3=A9tard?= Date: Mon, 16 Nov 2015 22:49:08 +0100 Subject: [PATCH] =?utf8?q?Lors=20de=20l=E2=80=99analyse,=20si=20le=20fichi?= =?utf8?q?er=20n=E2=80=99est=20pas=20dans=20le=20bon=20format=20=3D>=20err?= =?utf8?q?eur=20503?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- femtoblackweb.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/femtoblackweb.py b/femtoblackweb.py index 1138e71..14d556e 100644 --- a/femtoblackweb.py +++ b/femtoblackweb.py @@ -108,9 +108,12 @@ def analyze_file(filename): json_file = os.path.join(app.config['UPLOAD_FOLDER'], "{}.json".format(filename)) if os.path.exists(f) and os.path.isfile(json_file): - with open(json_file) as json_f: - json_content = json.load(json_f) - return render_template('analyze_file.html', filename=filename, json=json_content) + try: + with open(json_file) as json_f: + json_content = json.load(json_f) + return render_template('analyze_file.html', filename=filename, json=json_content) + except ValueError as e: + abort(503) else: abort(404) -- 2.30.2