aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/controllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-11-01 02:21:32 +0300
committerGravatar Vitaly Takmazov2017-11-01 02:21:32 +0300
commit0dcabe039a51a3a1aebd9a656a8dde2895b5e03a (patch)
tree0cc0ebbe358b08869e4878aa3ec641f69bf16946 /juick-www/src/main/java/com/juick/www/controllers
parent4790deec83f711a797ba23b6d658d516e865dd85 (diff)
www: fix /comment multiparts with empty body
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
index 2b411523..8f7c8059 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
@@ -195,15 +195,12 @@ public class NewMessage {
@PostMapping("/comment")
public String doPostComment(
- @RequestParam(required = false, defaultValue = "0") Integer mid,
+ @RequestParam Integer mid,
@RequestParam(required = false, defaultValue = "0") Integer rid,
@RequestParam(required = false, defaultValue = StringUtils.EMPTY) String body,
- @RequestParam(required = false) String img,
+ @RequestParam(required = false, defaultValue = StringUtils.EMPTY) String img,
@RequestParam(required = false) MultipartFile attach) throws IOException {
com.juick.User visitor = UserUtils.getCurrentUser();
- if (mid == 0) {
- throw new HttpBadRequestException();
- }
com.juick.Message msg = messagesService.getMessage(mid);
if (msg == null) {
throw new HttpNotFoundException();
@@ -217,7 +214,7 @@ public class NewMessage {
}
}
- if ((StringUtils.isEmpty(body) || body.length() > 4096) && StringUtils.isEmpty(img)) {
+ if ((StringUtils.isEmpty(body) || body.length() > 4096) && StringUtils.isEmpty(img) && attach == null) {
throw new HttpBadRequestException();
}
body = body.replace("\r", StringUtils.EMPTY);