Skip to content

Commit a9d2380

Browse files
authored
Fix #1044: truncate comment to avoid exceeding max length (#1081)
1 parent 7b32e28 commit a9d2380

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

jbi/jira/service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ def add_jira_comment(self, context: ActionContext):
130130
comment = context.bug.comment
131131
assert comment # See jbi.steps.create_comment()
132132
assert comment.body # Also see jbi.steps.create_comment()
133-
formatted_comment = (
134-
f"*{commenter}* commented: \n{markdown_to_jira(comment.body)}"
133+
prefix = f"*{commenter}* commented: \n"
134+
formatted_comment = prefix + markdown_to_jira(
135+
comment.body,
136+
max_length=JIRA_DESCRIPTION_CHAR_LIMIT - len(prefix),
135137
)
136138

137139
issue_key = context.jira.issue

0 commit comments

Comments
 (0)