Bug fix for calling get_commons_image with 'null'

This commit is contained in:
Edward Betts 2024-06-19 14:43:23 +01:00
parent 3f04c82ba9
commit 4d64ac212d

View file

@ -244,9 +244,12 @@ def identifier_index():
@app.route("/commons/<filename>") @app.route("/commons/<filename>")
def get_commons_image(filename): def get_commons_image(filename):
if filename == "null":
flask.abort(404)
detail = commons.image_detail([filename], thumbheight=1200, thumbwidth=1200) detail = commons.image_detail([filename], thumbheight=1200, thumbwidth=1200)
image = detail[filename] if filename not in detail:
return flask.redirect(image["thumburl"]) flask.abort(404)
return flask.redirect(detail[filename]["thumburl"])
@app.route("/identifier/<pid>") @app.route("/identifier/<pid>")