From 4d64ac212d300be018d2ac27e08870670756a523 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 19 Jun 2024 14:43:23 +0100 Subject: [PATCH] Bug fix for calling get_commons_image with 'null' --- web_view.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web_view.py b/web_view.py index 4a2edac..9003fde 100755 --- a/web_view.py +++ b/web_view.py @@ -244,9 +244,12 @@ def identifier_index(): @app.route("/commons/") def get_commons_image(filename): + if filename == "null": + flask.abort(404) detail = commons.image_detail([filename], thumbheight=1200, thumbwidth=1200) - image = detail[filename] - return flask.redirect(image["thumburl"]) + if filename not in detail: + flask.abort(404) + return flask.redirect(detail[filename]["thumburl"]) @app.route("/identifier/")