From 17c97aebd6e726eb574384576e9864b97810b22b Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 18 Jan 2018 16:36:45 +0300 Subject: tg: escape reply quote too, no need to escape links --- juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java | 3 ++- juick-core/src/main/java/com/juick/util/MessageUtils.java | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'juick-core/src/main/java/com') diff --git a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java index ebeaef42..412e7b7c 100644 --- a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java +++ b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java @@ -39,7 +39,8 @@ public class PlainTextFormatter { StringBuilder sb = new StringBuilder(); boolean isReply = jmsg.getRid() > 0; String title = isReply ? "Reply by @" : "@"; - String subtitle = isReply ? jmsg.getReplyQuote() : markdown ? MessageUtils.getMarkdownTags(jmsg) : jmsg.getTagsString(); + String subtitle = isReply ? markdown ? MessageUtils.escapeMarkdown(jmsg.getReplyQuote()) : jmsg.getReplyQuote() + : markdown ? MessageUtils.getMarkdownTags(jmsg) : jmsg.getTagsString(); sb.append(title).append(jmsg.getUser().getName()).append(":\n") .append(subtitle).append("\n"); if (markdown) { diff --git a/juick-core/src/main/java/com/juick/util/MessageUtils.java b/juick-core/src/main/java/com/juick/util/MessageUtils.java index fa0072b2..97d55b09 100644 --- a/juick-core/src/main/java/com/juick/util/MessageUtils.java +++ b/juick-core/src/main/java/com/juick/util/MessageUtils.java @@ -195,8 +195,6 @@ public class MessageUtils { } public static String escapeMarkdown(final String s) { return s.replace("_", "\\_").replace("*", "\\*") - .replace("~", "\\~").replace("[", "\\[") - .replace("]", "\\]").replace("(", "\\(") - .replace(")", "\\)").replace("`", "\\`"); + .replace("`", "\\`"); } } -- cgit v1.2.3