irc: Strip lone backslashes from tag values

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
This commit is contained in:
Hubert Hirtz 2020-06-18 17:55:47 +02:00 committed by Simon Ser
parent a1582dcc62
commit e1dccb8562
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -36,6 +36,9 @@ function parseTags(s) {
for (var ch in tagsEscape) { for (var ch in tagsEscape) {
v = v.replaceAll(tagsEscape[ch], ch); v = v.replaceAll(tagsEscape[ch], ch);
} }
if (v.endsWith("\\")) {
v = v.slice(0, v.length - 1)
}
tags[k] = v; tags[k] = v;
}); });
return tags; return tags;