From b391b87e29be87ed0fd813f2eddc3c5f09ea8f0c Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Fri, 8 Dec 2017 21:09:23 +0200 Subject: [PATCH] Clean monospace and strikethrough formatters --- .../libs/handlebars/ircmessageparser/cleanIrcMessage.js | 2 +- .../libs/handlebars/ircmessageparser/cleanIrcMessage.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js b/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js index 8e4c4a9d..3cf052d8 100644 --- a/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js +++ b/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js @@ -1,5 +1,5 @@ "use strict"; -const matchFormatting = /\x02|\x1D|\x1F|\x16|\x0F|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi; +const matchFormatting = /\x02|\x1D|\x1F|\x16|\x0F|\x11|\x1E|\x03(?:[0-9]{1,2}(?:,[0-9]{1,2})?)?|\x04(?:[0-9a-f]{6}(?:,[0-9a-f]{6})?)?/gi; module.exports = (message) => message.replace(matchFormatting, "").trim(); diff --git a/test/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js b/test/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js index 5717ea78..d1773abf 100644 --- a/test/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js +++ b/test/client/js/libs/handlebars/ircmessageparser/cleanIrcMessage.js @@ -23,6 +23,15 @@ describe("cleanIrcMessage", function() { }, { input: "\x1ditalic", expected: "italic", + }, { + input: "\x1estrikethrough", + expected: "strikethrough", + }, { + input: "\x11monospace", + expected: "monospace", + }, { + input: "\x16reset color", + expected: "reset color", }, { input: "\x1funderline", expected: "underline",