aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Browne <me@t3.gg>2025-02-15 18:16:14 -0800
committerGitHub <noreply@github.com>2025-02-15 18:16:14 -0800
commitf96ce5706d1ab3f29a0faa00ce4a357807555dc2 (patch)
tree86ac0852fb533bd29d4479ab44f769c6d5a12d29
parent5cf34e346727ceb14c92474c52a3d83bd8d27b79 (diff)
parent001e48129b730959b3e841d94bda86e9bc028795 (diff)
downloadunkagi-f96ce5706d1ab3f29a0faa00ce4a357807555dc2.tar.xz
unkagi-f96ce5706d1ab3f29a0faa00ce4a357807555dc2.zip
Merge pull request #5 from samyakbardiya/fix/handle-non-alphanumeric-chars
fix: Handle non-alphanumeric characters in bangs
-rw-r--r--src/main.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.ts b/src/main.ts
index c6e00af..7b81419 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -55,13 +55,13 @@ function getBangredirectUrl() {
return null;
}
- const match = query.match(/!([a-z0-9]+)/i);
+ const match = query.match(/!(\S+)/i);
const bangCandidate = match?.[1]?.toLowerCase();
const selectedBang = bangs.find((b) => b.t === bangCandidate) ?? defaultBang;
// Remove the first bang from the query
- const cleanQuery = query.replace(/![a-z0-9]+\s*/i, "").trim();
+ const cleanQuery = query.replace(/!\S+\s*/i, "").trim();
// Format of the url is:
// https://www.google.com/search?q={{{s}}}