Merge branch '88-crash-on-fetching-image-information' into 'testing'

Resolve "Crash on fetching image information"

See merge request piotrex43/RcGcDw!52
This commit is contained in:
Frisk 2019-06-11 17:31:56 +00:00
commit d6e56fb18b

View file

@ -508,7 +508,11 @@ def embed_formatter(action, change, parsed_comment, categories):
if action == "upload/overwrite": if action == "upload/overwrite":
if additional_info_retrieved: if additional_info_retrieved:
article_encoded = change["title"].replace(" ", "_").replace(')', '\)') article_encoded = change["title"].replace(" ", "_").replace(')', '\)')
try:
img_timestamp = [x for x in img_info[1]["timestamp"] if x.isdigit()] img_timestamp = [x for x in img_info[1]["timestamp"] if x.isdigit()]
except IndexError:
logger.exception("Could not analize the information about the image (does it have only one version when expected more in overwrite?) which resulted in no Options field: {}".format(img_info))
else:
undolink = "https://{wiki}.gamepedia.com/index.php?title={filename}&action=revert&oldimage={timestamp}%21{filenamewon}".format( undolink = "https://{wiki}.gamepedia.com/index.php?title={filename}&action=revert&oldimage={timestamp}%21{filenamewon}".format(
wiki=settings["wiki"], filename=article_encoded, timestamp="".join(img_timestamp), wiki=settings["wiki"], filename=article_encoded, timestamp="".join(img_timestamp),
filenamewon=article_encoded.split(":", 1)[1]) filenamewon=article_encoded.split(":", 1)[1])