aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-03-07 11:40:37 +0100
committerSimon Ser <contact@emersion.fr>2024-03-07 11:40:37 +0100
commit57f7b1c0118d2cd02fda547451f8ab489b6a921f (patch)
treede632d53d36b741e399d468ee68df001a8770aad
parent5d3738bc40f9e4cb275146f762b3ec9de9492ce0 (diff)
downloadgamja-57f7b1c0118d2cd02fda547451f8ab489b6a921f.tar.gz
gamja-57f7b1c0118d2cd02fda547451f8ab489b6a921f.zip
lib/irc: fix whitespace split in isURIPrefix
We want to get the last index of whitespace, not the first one.
-rw-r--r--lib/irc.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/irc.js b/lib/irc.js
index 991c47d..d6d90c4 100644
--- a/lib/irc.js
+++ b/lib/irc.js
@@ -278,9 +278,11 @@ function isWordBoundary(ch) {
}
function isURIPrefix(text) {
- let i = text.search(space);
- if (i >= 0) {
- text = text.slice(i);
+ for (let i = text.length - 1; i >= 0; i--) {
+ if (text[i].search(space)) {
+ text = text.slice(i);
+ break;
+ }
}
i = text.indexOf("://");