new paste: check input length
Check the input length, if it's over 64k then this will put up an error page that says "Could not submit your paste because ..." Change-Id: I0ba3efbb33050272543b2f76a1cf0f49df26185c
This commit is contained in:
parent
e22ae1230b
commit
bc2678dc73
@ -55,6 +55,14 @@ class PasteController(object):
|
||||
'CAPTCHA solution was incorrect')
|
||||
show_captcha = True
|
||||
|
||||
# NOTE(ianw) 2022-04-19 : this goes into a mysql "text"
|
||||
# field that is 64k
|
||||
paste_max = 64 * 1024
|
||||
code_len = len(code.encode('utf-8'))
|
||||
if code_len > paste_max:
|
||||
error = _('your paste is over the 64k limit (by %d)' %
|
||||
(code_len - paste_max))
|
||||
|
||||
if code and language and not error:
|
||||
paste = Paste(code, language, parent_id, req.user_hash,
|
||||
'private' in req.form)
|
||||
|
Loading…
Reference in New Issue
Block a user