File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ var response = {
32
32
errorBadRequest : function ( res ) {
33
33
responseError ( res , '400' , 'Bad Request' , 'something not right.' )
34
34
} ,
35
+ errorTooLong : function ( res ) {
36
+ responseError ( res , '413' , 'Payload Too Large' , 'Shorten your note!' )
37
+ } ,
35
38
errorInternalError : function ( res ) {
36
39
responseError ( res , '500' , 'Internal Error' , 'wtf.' )
37
40
} ,
@@ -145,7 +148,12 @@ function responseCodiMD (res, note) {
145
148
146
149
function newNote ( req , res , next ) {
147
150
var owner = null
148
- var body = req . body ? req . body : ''
151
+ var body = ''
152
+ if ( req . body && req . body . length > config . documentMaxLength ) {
153
+ return response . errorTooLong ( res )
154
+ } else {
155
+ body = req . body
156
+ }
149
157
body = body . replace ( / [ \r ] / g, '' )
150
158
if ( req . isAuthenticated ( ) ) {
151
159
owner = req . user . id
You can’t perform that action at this time.
0 commit comments