diff options
author | Magnus Hagander | 2024-12-10 12:09:10 +0000 |
---|---|---|
committer | Magnus Hagander | 2024-12-10 12:09:10 +0000 |
commit | 63faa7d73c53629aa6ae9cf3d497f37cec50cd9e (patch) | |
tree | 63b7d206fbcd7576ca08a200b9ebb2e37914227d /pgcommitfest/commitfest/ajax.py | |
parent | 845dc635f2e01da4a8c042094c9c5208aa6c8f04 (diff) |
DOn't crash on very long annotations
When a very long annotation is posted, we would crash if it's shorter
than 500 characters, but the length of the *log* message became longer
than 500. To handle this, shorten the text in the log message if it's
too long.
Diffstat (limited to 'pgcommitfest/commitfest/ajax.py')
-rw-r--r-- | pgcommitfest/commitfest/ajax.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pgcommitfest/commitfest/ajax.py b/pgcommitfest/commitfest/ajax.py index e2fcb55..eaf7cdc 100644 --- a/pgcommitfest/commitfest/ajax.py +++ b/pgcommitfest/commitfest/ajax.py @@ -8,6 +8,7 @@ from django.db import transaction import requests import json +import textwrap from pgcommitfest.auth import user_search from .models import CommitFest, Patch, MailThread, MailThreadAttachment @@ -114,7 +115,7 @@ def annotateMessage(request): annotation.save() for p in thread.patches.all(): - PatchHistory(patch=p, by=request.user, what='Added annotation "%s" to %s' % (msg, msgid)).save_and_notify() + PatchHistory(patch=p, by=request.user, what='Added annotation "%s" to %s' % (textwrap.shorten(msg, 100), msgid)).save_and_notify() p.set_modified() p.save() |