Browse Source

Aggressively filter empty text in slack hooks.

master
Chris Smith 5 years ago
parent
commit
6b107fbbb9
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      lineandsinker/services/slack.py

+ 7
- 2
lineandsinker/services/slack.py View File

@@ -13,8 +13,13 @@ class Slack(Service):
13 13
         else:
14 14
             content = json.loads(request.form["payload"])
15 15
 
16
-        text = content["text"]
16
+        text = content["text"].strip()
17 17
         if "attachments" in content:
18
-            text += " " + " ".join(a["fallback"] for a in content["attachments"])
18
+            text += " " + " ".join(
19
+                filter(
20
+                    lambda x: len(x) > 0,
21
+                    (a["fallback"].strip() for a in content["attachments"]),
22
+                )
23
+            )
19 24
 
20 25
         yield {"type": f"slack", "source": identifier, "text": text}

Loading…
Cancel
Save