diff options
author | Vitaly Takmazov | 2018-04-04 23:31:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-04 23:31:27 +0300 |
commit | 33e5ed803d8165c265b1ce435716700db3b576d4 (patch) | |
tree | d0d348d0d07126e9a353b526bfe3cb6d9b63e72b /juick-server-xmpp/src/main | |
parent | 26e8eb9f0f965bb51733b4a25734f0ebe658b9ed (diff) |
fix empty reply with attachment
Diffstat (limited to 'juick-server-xmpp/src/main')
-rw-r--r-- | juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java index c94e70f3..e2be6aaf 100644 --- a/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java +++ b/juick-server-xmpp/src/main/java/com/juick/server/CommandsManager.java @@ -451,12 +451,12 @@ public class CommandsManager { } return CommandResult.fromString("Your feed is empty"); } - @UserCommand(pattern = "^(#|\\.)(\\d+)((\\.|\\-|\\/)(\\d+))?\\s([\\s\\S]+)", + @UserCommand(pattern = "^(#|\\.)(\\d+)((\\.|\\-|\\/)(\\d+))?\\s([\\s\\S]+)?", help = "#1234 *tag *tag2 - edit tags\n#1234 text - reply to message") public CommandResult EditOrReply(User user, Jid from, @Nonnull URI attachment, String... args) throws Exception { int mid = NumberUtils.toInt(args[1]); int rid = NumberUtils.toInt(args[4], 0); - String txt = args[5]; + String txt = StringUtils.defaultString(args[5]); List<Tag> messageTags = tagService.fromString(txt, true); if (messageTags.size() > 0) { if (user.getUid() != messagesService.getMessageAuthor(mid).getUid()) { @@ -465,7 +465,8 @@ public class CommandsManager { tagService.updateTags(mid, messageTags); return CommandResult.fromString("Tags are updated"); } else { - String attachmentType = StringUtils.isNotEmpty(attachment.toString()) ? attachment.toString().substring(attachment.toString().length() - 3) : null; + String attachmentStr = attachment.toString(); + String attachmentType = StringUtils.isNotEmpty(attachmentStr) ? attachmentStr.substring(attachmentStr.length() - 3) : null; int newrid = messagesService.createReply(mid, rid, user.getUid(), txt, attachmentType); if (StringUtils.isNotEmpty(attachmentType)) { String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost() |