From bf96ec645ebd67e9833c2faba8bbd74ff30c6bb8 Mon Sep 17 00:00:00 2001 From: Sloane Simmons Date: Sat, 31 Oct 2015 20:03:44 -0500 Subject: [PATCH] Enforce DB content length limit Content length limit of 1000 characters at DB level should be enforced at the application level. --- forum.nim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forum.nim b/forum.nim index 9427fe3..e657a93 100644 --- a/forum.nim +++ b/forum.nim @@ -462,6 +462,10 @@ template retrContent(c: expr) = let content {.inject.} = c.req.params["content"] if content.strip.len < 10: return setError(c, "content", "Content not long enough") + # Enforce DB content length for posts + elif content.len > 1000: + return setError(c, "content", "Post length too long") + if not validateRst(c, content): return false template retrPost(c: expr) =