From be072cfd8b13114d9644f46217871b7d02d4fea7 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 25 Feb 2022 12:10:41 -0600 Subject: limiting explanation length --- src/main.lisp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.lisp b/src/main.lisp index 27afeda..26df348 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -519,9 +519,11 @@ have exceeded the invite limit." "On success, return an object containing a new [invite token](#invite-token)." (to-json (make-new-invite (api-contributor token)))) +(defparameter +explanation-wordcount-limit+ 550) + (defun validate-new-oneliner-plist (plist) (with-plist - (oneliner tags brief runstyle) plist + (oneliner tags brief runstyle explanation) plist (unless tags (http-err 400 "A oneliner requires tags")) (unless brief @@ -530,6 +532,9 @@ have exceeded the invite limit." (http-err 400 "Brief description is too long. Limit to 75 characters")) (unless oneliner (http-err 400 "Oneliner cannot be blank")) + (when explanation + (unless (<= (count #\space explanation) +explanation-wordcount-limit+) + (http-err 400 "Explanation is too long. Limit to around 500 words."))) (when runstyle (setf runstyle (a:make-keyword runstyle)) (unless (typep runstyle 'runstyle) -- cgit v1.2.3