mirror of https://github.com/zulip/zulip.git
slack_incoming: Verify that keys exist before checking their value.
This commit is contained in:
parent
f1a8209705
commit
eb3674362a
|
@ -19,12 +19,20 @@
|
|||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Title without value",
|
||||
"title": "Title with null value",
|
||||
"value": null,
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": "Title without value",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"title": null,
|
||||
"value": "Value with null title",
|
||||
"short": true
|
||||
},
|
||||
{
|
||||
"value": "Value without title",
|
||||
"short": true
|
||||
},
|
||||
|
|
|
@ -191,7 +191,9 @@ Build bla bla succeeded
|
|||
**Requested by**: Some user
|
||||
**Duration**: 00:02:03
|
||||
**Build pipeline**: ConsumerAddressModule
|
||||
**Title with null value**
|
||||
**Title without value**
|
||||
Value with null title
|
||||
Value without title
|
||||
""".strip()
|
||||
|
||||
|
|
|
@ -193,14 +193,14 @@ def render_attachment(attachment: WildValue) -> str:
|
|||
if "fields" in attachment:
|
||||
fields = []
|
||||
for field in attachment["fields"]:
|
||||
if field["title"] and field["value"]:
|
||||
if "title" in field and "value" in field and field["title"] and field["value"]:
|
||||
title = field["title"].tame(check_string)
|
||||
value = field["value"].tame(check_string)
|
||||
fields.append(f"*{title}*: {value}")
|
||||
elif field["title"]:
|
||||
elif "title" in field and field["title"]:
|
||||
title = field["title"].tame(check_string)
|
||||
fields.append(f"*{title}*")
|
||||
elif field["value"]:
|
||||
elif "value" in field and field["value"]:
|
||||
value = field["value"].tame(check_string)
|
||||
fields.append(f"{value}")
|
||||
pieces.append("\n".join(fields))
|
||||
|
|
Loading…
Reference in New Issue