From 996e58b2611fd1c2d3a18222b1683335753da680 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 30 Jan 2019 09:48:40 +0300 Subject: Do not modify replies without attachments --- src/main/java/com/juick/server/CommandsManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/server/CommandsManager.java b/src/main/java/com/juick/server/CommandsManager.java index 1c726e60..08dafe77 100644 --- a/src/main/java/com/juick/server/CommandsManager.java +++ b/src/main/java/com/juick/server/CommandsManager.java @@ -542,10 +542,10 @@ public class CommandsManager { } } } - boolean attachmentDownloaded = StringUtils.isNotEmpty(attachmentType); - String messageText = attachmentDownloaded ? txt : String.format("%s %s", txt, attachment.toASCIIString()); + boolean attachmentProcessed = !haveAttachment || StringUtils.isNotEmpty(attachmentType); + String messageText = attachmentProcessed ? txt : String.format("%s %s", txt, attachment.toASCIIString()); int newrid = messagesService.createReply(mid, rid, user, messageText, attachmentType); - if (attachmentDownloaded) { + if (haveAttachment && attachmentProcessed) { String fname = String.format("%d-%d.%s", mid, newrid, attachmentType); imagesService.saveImageWithPreviews(attachmentFName, fname); } -- cgit v1.2.3