Skip to content

Commit a7e4062

Browse files
committed
fix #457 extra leading slashes on path
1 parent e4a13f6 commit a7e4062

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/good-mugs-brake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@solidjs/router": patch
3+
---
4+
5+
fix #457 extra leading slashes on path

src/routers/Router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type RouterProps = BaseRouterProps & { url?: string, actionBase?: string,
1111
export function Router(props: RouterProps): JSX.Element {
1212
if (isServer) return StaticRouter(props);
1313
const getSource = () => {
14-
const url = window.location.pathname + window.location.search;
14+
const url = window.location.pathname.replace(/^\/+/, "/") + window.location.search;
1515
return {
1616
value: props.transformUrl ? props.transformUrl(url) + window.location.hash : url + window.location.hash,
1717
state: window.history.state

0 commit comments

Comments
 (0)