Explorar o código

reject empty body

Yuki Takei %!s(int64=2) %!d(string=hai) anos
pai
achega
53dad7abb6
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      apps/app/src/server/routes/comment.js

+ 4 - 0
apps/app/src/server/routes/comment.js

@@ -244,6 +244,10 @@ module.exports = function(crowi, app) {
       return res.json(ApiResponse.error('Current user is not accessible to this page.'));
       return res.json(ApiResponse.error('Current user is not accessible to this page.'));
     }
     }
 
 
+    if (comment === '') {
+      return res.json(ApiResponse.error('Comment text is required'));
+    }
+
     let createdComment;
     let createdComment;
     try {
     try {
       createdComment = await Comment.add(pageId, req.user._id, revisionId, comment, position, replyTo);
       createdComment = await Comment.add(pageId, req.user._id, revisionId, comment, position, replyTo);