lib/irc: fix whitespace RegExp test in isURIPrefix

This commit is contained in:
Simon Ser 2024-03-13 15:40:33 +01:00
parent c1c7c91c38
commit 3584c1eb10

View File

@ -264,7 +264,7 @@ const alphaNum = (() => {
return new RegExp(/^[a-zA-Z0-9]$/, "u");
}
})();
const space = new RegExp(/\s/);
const space = new RegExp(/^\s$/);
function isWordBoundary(ch) {
switch (ch) {
@ -279,7 +279,7 @@ function isWordBoundary(ch) {
function isURIPrefix(text) {
for (let i = text.length - 1; i >= 0; i--) {
if (text[i].search(space)) {
if (space.test(text[i])) {
text = text.slice(i);
break;
}