Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent invalid path name #793

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/next-on-pages/templates/_worker.js/routes-matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ export class RoutesMatcher {
this.path = this.path.replace(/\.rsc/i, '');
}

// Prevent `//` in path names.
this.path = this.path.replace(/\/\//g, '/')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is ok as // is always ok to squash to / 🤔

but I think it'd be great to investigate this further and understanding why we end up with // 🤔

I'm guessing that we're doing something wrong earlier during the request handling process

I'm happy to investigate this and or @simmbiote please let me know if you'd like to 🙂


// Merge search params for later use when serving a response.
const destUrl = new URL(this.path, this.url);
applySearchParams(this.searchParams, destUrl.searchParams);
Expand Down