Skip to content

Commit

Permalink
Fix #1044: truncate comment to avoid exceeding max length (#1081)
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem authored Dec 11, 2024
1 parent 7b32e28 commit a9d2380
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jbi/jira/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a9d2380

Please # to comment.