Skip to content

Commit 06b8c1b

Browse files
authored
Prevent invalid path name
Suggested fix for issue #792, where `//` exists in this.path, causing an exception to break the page.
1 parent c2b173c commit 06b8c1b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/next-on-pages/templates/_worker.js/routes-matcher.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ export class RoutesMatcher {
361361
this.path = this.path.replace(/\.rsc/i, '');
362362
}
363363

364+
// Prevent `//` in path names.
365+
this.path = this.path.replace(/\/\//g, '/')
366+
364367
// Merge search params for later use when serving a response.
365368
const destUrl = new URL(this.path, this.url);
366369
applySearchParams(this.searchParams, destUrl.searchParams);

0 commit comments

Comments
 (0)