From 3d447c9d1892966f9048501eb74b569e72d08347 Mon Sep 17 00:00:00 2001 From: Andre D Date: Mon, 20 May 2013 22:57:52 -0700 Subject: [PATCH] reddit: Add missing length check on friend and banning note fields. --- r2/r2/controllers/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index b9f9fcec5..d164c85b5 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -810,6 +810,8 @@ class ApiController(RedditController, OAuth2ResourceController): friend = VExistingUname('name'), note = VLength('note', 300)) def POST_friendnote(self, form, jquery, friend, note): + if form.has_errors("note", errors.TOO_LONG): + return c.user.add_friend_note(friend, note) form.set_html('.status', _("saved")) @@ -817,6 +819,8 @@ class ApiController(RedditController, OAuth2ResourceController): user = VExistingUname('name'), note = VLength('note', 300)) def POST_relnote(self, form, jquery, type, user, note): + if form.has_errors("note", errors.TOO_LONG): + return c.site.add_rel_note(type[:-4], user, note) form.set_html('.status', _("saved"))