mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-24 00:34:10 +00:00
Fixed an issue where RcGcDw might crash due to previous image revision not having archivename
This commit is contained in:
parent
774854c338
commit
afc503a285
|
@ -177,15 +177,19 @@ def embed_upload_upload(ctx: Context, change: dict) -> DiscordMessage:
|
||||||
if action in ("upload/overwrite", "upload/revert"):
|
if action in ("upload/overwrite", "upload/revert"):
|
||||||
if image_direct_url:
|
if image_direct_url:
|
||||||
try:
|
try:
|
||||||
revision = image_data["imageinfo"][num + 1]
|
archive_name = image_data["imageinfo"][num + 1]["archivename"]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
logger.exception(
|
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(
|
"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(
|
||||||
image_data["imageinfo"]))
|
image_data["imageinfo"]))
|
||||||
|
except KeyError:
|
||||||
|
logger.exception(
|
||||||
|
"Could not analize the information about the image, one of its revisions might have been deleted: {}".format(
|
||||||
|
image_data["imageinfo"]))
|
||||||
else:
|
else:
|
||||||
undolink = "{wiki}index.php?title={filename}&action=revert&oldimage={archiveid}".format(
|
undolink = "{wiki}index.php?title={filename}&action=revert&oldimage={archiveid}".format(
|
||||||
wiki=ctx.client.WIKI_SCRIPT_PATH, filename=sanitize_to_url(change["title"]),
|
wiki=ctx.client.WIKI_SCRIPT_PATH, filename=sanitize_to_url(change["title"]),
|
||||||
archiveid=revision["archivename"])
|
archiveid=archive_name)
|
||||||
embed.add_field(ctx._("Options"), ctx._("([preview]({link}) | [undo]({undolink}))").format(
|
embed.add_field(ctx._("Options"), ctx._("([preview]({link}) | [undo]({undolink}))").format(
|
||||||
link=image_direct_url, undolink=undolink))
|
link=image_direct_url, undolink=undolink))
|
||||||
if ctx.settings["appearance"]["embed"]["embed_images"]:
|
if ctx.settings["appearance"]["embed"]["embed_images"]:
|
||||||
|
|
Loading…
Reference in a new issue