소스 검색

Aggressively filter empty text in slack hooks.

master
Chris Smith 6 년 전
부모
커밋
6b107fbbb9
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7
    2
      lineandsinker/services/slack.py

+ 7
- 2
lineandsinker/services/slack.py 파일 보기

@@ -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…
취소
저장