Skip to content

Commit 60fd292

Browse files
authored
fix: search query ? breaking modal interception (#269)
1 parent 6f92e7d commit 60fd292

File tree

1 file changed

+7
-2
lines changed
  • packages/open-next/src/adapters/routing

1 file changed

+7
-2
lines changed

packages/open-next/src/adapters/routing/util.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ export function isExternal(url?: string) {
1212
}
1313

1414
export function getUrlParts(url: string, isExternal: boolean) {
15+
// NOTE: when redirect to a URL that contains search query params,
16+
// compile breaks b/c it does not allow for the '?' character
17+
// We can't use encodeURIComponent because modal interception contains
18+
// characters that can't be encoded
19+
url = url.replaceAll("?", "%3F");
1520
if (!isExternal) {
1621
return {
1722
hostname: "",
18-
pathname: encodeURIComponent(url),
23+
pathname: url,
1924
protocol: "",
2025
};
2126
}
2227
const { hostname, pathname, protocol } = new URL(url);
2328
return {
2429
hostname,
25-
pathname: encodeURIComponent(pathname),
30+
pathname,
2631
protocol,
2732
};
2833
}

0 commit comments

Comments
 (0)