From 6ff9ccdbb11ce027641daea9e35402c75ddb0e57 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 6 Feb 2019 17:34:10 +0100 Subject: [PATCH] [fix] comment can be None --- server.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 766ab6f..6ad38be 100644 --- a/server.py +++ b/server.py @@ -247,7 +247,14 @@ async def github(request): pull_request_number = request.json["pull_request"]["number"] pull_request_title = request.json["pull_request"]["title"] url = request.json["pull_request"]["html_url"] - comment = request.json["pull_request"]["body"].replace("\r\n", " ") + comment = request.json["pull_request"]["body"] + + if comment and len(comment) > 120: + comment = ": " + comment[:120].replace("\r\n", " ") + "..." + elif not comment: + comment = "" + else: + comment = ": " + comment.replace("\r\n", " ") if action in ("opened", "edited", "deleted", "transferred", "pinned", "unpinned", "reopened"):