Truncate notifs with too-long bodies.

In general, we don't do a great job of length validating body_html
fields. Lots of ways to get 500 errors by providing too long of
input. Really ought to find a way to fix it in the classes/comment.py
and classes/submission.py classes. In the interim, the recent gifts
messages change is salient because the notification can 500 out
mid-way through performing coin transactions.

Recommended to find a better way of truncating or safely bubbling
the exception up. Truncating probably not best long-term solution
because it could hypothetically permit strings that would otherwise
be considered unsanitized.
master
Snakes 2022-06-01 00:54:05 -04:00
parent 1d49012c16
commit 227ddbec0e
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ def create_comment(text_html, autojanny=False):
new_comment = Comment(author_id=author_id,
parent_submission=None,
body_html=text_html,
body_html=text_html[:40000],
distinguish_level=6)
g.db.add(new_comment)
g.db.flush()