~emersion/public-inbox

gamja: irc: Strip lone backslashes from tag values v1 APPLIED

Hubert Hirtz: 1
 irc: Strip lone backslashes from tag values

 1 files changed, 3 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/11249/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gamja] irc: Strip lone backslashes from tag values Export this patch

According to the message-tags spec:

> If a lone \ exists at the end of an escaped value (with no escape
> character following it), then there SHOULD be no output character. For
> example, the escaped value test\ should unescape to test.

https://ircv3.net/specs/extensions/message-tags
---
 lib/irc.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/irc.js b/lib/irc.js
index 37bb4cb..6766a1b 100644
--- a/lib/irc.js
+++ b/lib/irc.js
@@ -36,6 +36,9 @@ function parseTags(s) {
		for (var ch in tagsEscape) {
			v = v.replaceAll(tagsEscape[ch], ch);
		}
		if (v.endsWith("\\")) {
			v = v.slice(0, v.length - 1)
		}
		tags[k] = v;
	});
	return tags;
-- 
2.27.0
Pushed, thanks!