From c40d26c651dfb04b762d4476de106c28770d8bcc Mon Sep 17 00:00:00 2001 From: reya Date: Tue, 23 Jan 2024 14:11:01 +0700 Subject: [PATCH] fix invalid url --- src/daemon/web/authorize.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon/web/authorize.ts b/src/daemon/web/authorize.ts index 8ad7551..73afeed 100644 --- a/src/daemon/web/authorize.ts +++ b/src/daemon/web/authorize.ts @@ -49,7 +49,7 @@ export async function authorizeRequestWebHandler(request, reply) { const record = await getAndValidateStateOfRequest(request); const url = new URL(request.url, `http://${request.headers.host}`); const callbackUrl = url.searchParams.get("callbackUrl"); - const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, ''); + const baseUrl = new URL(request.url).pathname.replace(/\/+$/, ''); const method = record.method; let nip05: string | undefined; @@ -164,7 +164,7 @@ export async function processRegistrationWebHandler(request, reply) { try { const record = await getAndValidateStateOfRequest(request); const body = request.body; - const baseUrl = new URL(request.url).pathname?.split('/')?.[1]?.replace(/\/+$/, ''); + const baseUrl = new URL(request.url).pathname.replace(/\/+$/, ''); // we serialize the payload again and store it // along with the allowed flag