Skip to content
Browse files

subreddit: Check the correct value of length for prevstyle.

  • Loading branch information...
1 parent 53e29b2 commit 44b939d1cf2ad8fe494ff15658eb1652d7752eef @andre-d committed Sep 21, 2012
Showing with 4 additions and 1 deletion.
  1. +3 −1 r2/r2/controllers/api.py
  2. +1 −0 r2/r2/templates/subredditstylesheet.html
View
4 r2/r2/controllers/api.py
@@ -1220,12 +1220,14 @@ def POST_vote(self, dir, thing, ip, vote_type):
VModhash(),
# nop is safe: handled after auth checks below
stylesheet_contents = nop('stylesheet_contents'),
- prevstyle = VLength('prevstyle', max_length=256),
+ prevstyle = VLength('prevstyle', max_length=36),
op = VOneOf('op',['save','preview']))
@api_doc(api_section.subreddits)
def POST_subreddit_stylesheet(self, form, jquery,
stylesheet_contents = '', prevstyle='', op='save'):
+ if form.has_errors("prevstyle", errors.TOO_LONG):
+ return
report, parsed = c.site.parse_css(stylesheet_contents)
# Use the raw POST value as we need to tell the difference between
View
1 r2/r2/templates/subredditstylesheet.html
@@ -42,6 +42,7 @@
<h2>${_("stylesheet")}</h2>
<input type="hidden" name="prevstyle" value="${thing.site.prev_stylesheet}"/>
+ ${error_field("TOO_LONG", "prevstyle")}
<div class="sheets">
<div style="width: 100%" class="col">
<div>

0 comments on commit 44b939d

Please sign in to comment.
Something went wrong with that request. Please try again.