From 34f9a7dad5535870486edb304ee8043381f7cbdd Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 8 Dec 2016 16:14:34 +0300 Subject: juick-api: fix upload --- juick-api/src/main/java/com/juick/api/controllers/Post.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'juick-api/src/main/java/com/juick/api/controllers') diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 9749d700..40c6207e 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -111,7 +111,7 @@ public class Post { } } - String attachmentType = attachmentFName != null ? attachmentFName.substring(attachmentFName.length() - 3) : null; + String attachmentType = StringUtils.isNotEmpty(attachmentFName) ? attachmentFName.substring(attachmentFName.length() - 3) : null; int mid = messagesService.createMessage(vuid, body, attachmentType, tagsList); subscriptionService.subscribeMessage(mid, vuid); com.juick.Message jmsg = messagesService.getMessage(mid); @@ -124,7 +124,7 @@ public class Post { xmsg.addExtension(jmsg); xmsg.addExtension(new Nickname("@" + jmsg.getUser().getName())); - if (attachmentFName != null) { + if (StringUtils.isNotEmpty(attachmentFName)) { String fname = mid + "." + attachmentType; String attachmentURL = "http://i.juick.com/photos-1024/" + fname; @@ -227,7 +227,7 @@ public class Post { } } - String attachmentType = attachmentFName != null ? attachmentFName.substring(attachmentFName.length() - 3) : null; + String attachmentType = StringUtils.isNotEmpty(attachmentFName) ? attachmentFName.substring(attachmentFName.length() - 3) : null; int ridnew = messagesService.createReply(mid, rid, vuid, body, attachmentType); subscriptionService.subscribeMessage(mid, vuid); @@ -247,7 +247,7 @@ public class Post { xmsg.addExtension(new Nickname("@" + jmsg.getUser().getName())); - if (attachmentFName != null) { + if (StringUtils.isNotEmpty(attachmentFName)) { String fname = mid + "-" + ridnew + "." + attachmentType; String attachmentURL = "http://i.juick.com/photos-1024/" + fname; -- cgit v1.2.3