summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander2024-12-10 12:09:10 +0000
committerMagnus Hagander2024-12-10 12:09:10 +0000
commit63faa7d73c53629aa6ae9cf3d497f37cec50cd9e (patch)
tree63b7d206fbcd7576ca08a200b9ebb2e37914227d
parent845dc635f2e01da4a8c042094c9c5208aa6c8f04 (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.
-rw-r--r--pgcommitfest/commitfest/ajax.py3
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()