From 3898f04c0e65e3787d57014bf07aad5acdbec177 Mon Sep 17 00:00:00 2001 From: Shahriar <31452340+ShahriarKh@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:36:17 +0330 Subject: [PATCH] fix empty nested routes --- src/frame.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/frame.ts b/src/frame.ts index 370c85d..d22245a 100644 --- a/src/frame.ts +++ b/src/frame.ts @@ -45,12 +45,17 @@ export class CustomFrame { let src = new URL(this.data.url); if (urlSuffix) { - let suffix = new URL(urlSuffix, src); + let suffix = new URL(urlSuffix, src.origin); + suffix.searchParams.forEach((value, key) => { src.searchParams.set(key, value); }); + + if (suffix.pathname !== "/") { + src.pathname += suffix.pathname; + } + src.hash = suffix.hash || src.hash; - src.pathname += suffix.pathname; } this.frame.setAttribute("src", src.toString());