diff --git a/app/commands/incident.py b/app/commands/incident.py index 0752896d..77d6f62b 100644 --- a/app/commands/incident.py +++ b/app/commands/incident.py @@ -37,8 +37,9 @@ def handle_incident_action_buttons(client, ack, body, logger): f"<@{user}> a pris connaissance et ignoré l'incident." ) # if the last attachment is a preview from a link, switch the places of the last 2 attachments so that the incident buttons can be appended properly - if len(attachments) > 1 and attachments[-1]["app_unfurl_url"]: - attachments[-2], attachments[-1] = attachments[-1], attachments[-2] + if len(attachments) > 1: + if "app_unfurl_url" in attachments[-1]: + attachments[-2], attachments[-1] = attachments[-1], attachments[-2] attachments[-1] = { "color": "3AA3E3", "fallback": f"{msg}",