aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Vo <auscompgeek@users.noreply.github.com>2019-07-12 00:35:39 +1000
committerTollef Fog Heen <tfheen@err.no>2019-07-22 10:59:36 +0200
commit4a03c7a8cdf64413a781e2a56940f2d16299565d (patch)
tree3e187f2640ec050ad141e0c0f639d7cc3161e505
parent07d14d690aa6c4e2f11f9e8b4fdf5461b5bbf580 (diff)
downloadwee-slack-4a03c7a8cdf64413a781e2a56940f2d16299565d.tar.gz
Fix attachment fields without titles
Attachment fields are not guaranteed to have a title at all. This fixes in particular slackbot app approval messages, with an attachment like so: { "callback_id": "whitelist_A11BCGM0E_181389840855", "fields": [ { "short": true, "value": ":white_check_mark: *<@U4RPXA42F|davo> approved this app for the team.*" } ], "fallback": "Approve or deny the application", "id": 4, "color": "#2ab27b" }
-rw-r--r--wee_slack.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py
index c364105..ff607de 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3336,7 +3336,7 @@ def unwrap_attachments(message_json, text_before):
fields = attachment.get("fields")
if fields:
for f in fields:
- if f['title'] != '':
+ if f.get('title'):
t.append('%s %s' % (f['title'], f['value'],))
else:
t.append(f['value'])