Follow redirects for artwork

This commit is contained in:
Edward Betts 2020-06-30 11:17:21 +01:00
parent 298bef5c6b
commit fdd8b23118

4
app.py
View file

@ -397,6 +397,10 @@ def item_page(item_id):
from_redirect = qid in session and session.pop(qid) == 'from redirect' from_redirect = qid in session and session.pop(qid) == 'from redirect'
entity = mediawiki.get_entity_with_cache(qid, refresh=not from_redirect) entity = mediawiki.get_entity_with_cache(qid, refresh=not from_redirect)
if 'redirects' in entity:
redirect_to_item_id = int(entity['redirects']['to'][1:])
return redirect(url_for(request.endpoint, item_id=redirect_to_item_id))
existing_depicts = existing_depicts_from_entity(entity) existing_depicts = existing_depicts_from_entity(entity)
width = 800 width = 800