Skip to content

Commit 63faa7d

Browse files
committed
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.
1 parent 845dc63 commit 63faa7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: pgcommitfest/commitfest/ajax.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import requests
1010
import json
11+
import textwrap
1112

1213
from pgcommitfest.auth import user_search
1314
from .models import CommitFest, Patch, MailThread, MailThreadAttachment
@@ -114,7 +115,7 @@ def annotateMessage(request):
114115
annotation.save()
115116

116117
for p in thread.patches.all():
117-
PatchHistory(patch=p, by=request.user, what='Added annotation "%s" to %s' % (msg, msgid)).save_and_notify()
118+
PatchHistory(patch=p, by=request.user, what='Added annotation "%s" to %s' % (textwrap.shorten(msg, 100), msgid)).save_and_notify()
118119
p.set_modified()
119120
p.save()
120121

0 commit comments

Comments
 (0)