Skip to content

Commit d998bb8

Browse files
committed
doc: document funcs with links to their Next equivalents
1 parent af43eb4 commit d998bb8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

packages/open-next/src/core/routing/matcher.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ export function handleRewrites<T extends RewriteDefinition>(
263263
};
264264
}
265265

266+
// Normalizes repeated slashes in the path e.g. hello//world -> hello/world
267+
// or backslashes to forward slashes. This prevents requests such as //domain
268+
// from invoking the middleware with `request.url === "domain"`.
269+
// See: https://github.com/vercel/next.js/blob/3ecf087f10fdfba4426daa02b459387bc9c3c54f/packages/next/src/server/base-server.ts#L1016-L1020
266270
function handleRepeatedSlashRedirect(
267271
event: InternalEvent,
268272
): false | InternalResult {

packages/open-next/src/utils/normalize-path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export function normalizePath(path: string) {
44
return path.replace(/\\/g, "/");
55
}
66

7+
// See: https://github.com/vercel/next.js/blob/3ecf087f10fdfba4426daa02b459387bc9c3c54f/packages/next/src/shared/lib/utils.ts#L348
78
export function normalizeRepeatedSlashes(url: URL) {
89
const urlNoQuery = url.host + url.pathname;
910
return `${url.protocol}//${urlNoQuery

0 commit comments

Comments
 (0)