From f083bfdb9002bad2cf3b6e93783b7811eeed19ab Mon Sep 17 00:00:00 2001 From: Mathieu Leplatre Date: Wed, 11 Dec 2024 18:06:41 +0100 Subject: [PATCH] Fix #1044: truncate comment to avoid exceeding max length --- jbi/jira/service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jbi/jira/service.py b/jbi/jira/service.py index 40163408..9410d352 100644 --- a/jbi/jira/service.py +++ b/jbi/jira/service.py @@ -130,8 +130,10 @@ def add_jira_comment(self, context: ActionContext): comment = context.bug.comment assert comment # See jbi.steps.create_comment() assert comment.body # Also see jbi.steps.create_comment() - formatted_comment = ( - f"*{commenter}* commented: \n{markdown_to_jira(comment.body)}" + prefix = f"*{commenter}* commented: \n" + formatted_comment = prefix + markdown_to_jira( + comment.body, + max_length=JIRA_DESCRIPTION_CHAR_LIMIT - len(prefix), ) issue_key = context.jira.issue