From ecbddbc5746925e368796de7a1c90919e7cdd9dc Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Sun, 22 Sep 2024 15:20:22 -0400 Subject: [PATCH] fix: remove query params from getCurrentDomain --- src/libs/getCurrentDomain.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/getCurrentDomain.ts b/src/libs/getCurrentDomain.ts index 4e2af8c..d9bba18 100644 --- a/src/libs/getCurrentDomain.ts +++ b/src/libs/getCurrentDomain.ts @@ -1,5 +1,10 @@ import type { HonoRequest } from "hono"; export function getCurrentDomain(req: HonoRequest) { - return req.url.replace(req.path, ""); + let domain = req.url.replace(req.path, ""); + if (domain.includes("?")) { + domain = domain.split("?")[0]; + } + + return domain; }