File tree 2 files changed +5
-0
lines changed
2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,10 @@ export function handleRewrites<T extends RewriteDefinition>(
263
263
} ;
264
264
}
265
265
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
266
270
function handleRepeatedSlashRedirect (
267
271
event : InternalEvent ,
268
272
) : false | InternalResult {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ export function normalizePath(path: string) {
4
4
return path . replace ( / \\ / g, "/" ) ;
5
5
}
6
6
7
+ // See: https://github.com/vercel/next.js/blob/3ecf087f10fdfba4426daa02b459387bc9c3c54f/packages/next/src/shared/lib/utils.ts#L348
7
8
export function normalizeRepeatedSlashes ( url : URL ) {
8
9
const urlNoQuery = url . host + url . pathname ;
9
10
return `${ url . protocol } //${ urlNoQuery
You can’t perform that action at this time.
0 commit comments