Skip to content

Commit

Permalink
Re-use trailing slash util
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Aug 20, 2020
1 parent 2da380a commit 7f7be20
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/next/next-server/server/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { IncomingMessage, ServerResponse } from 'http'
import { UrlWithParsedQuery } from 'url'

import pathMatch from './lib/path-match'
import { removePathTrailingSlash } from '../../client/normalize-trailing-slash'

export const route = pathMatch()

Expand Down Expand Up @@ -133,7 +134,7 @@ export default class Router {
match: route('/:path*'),
fn: async (checkerReq, checkerRes, params, parsedCheckerUrl) => {
let { pathname } = parsedCheckerUrl
pathname = pathname?.replace(/\/$/, '') || '/'
pathname = removePathTrailingSlash(pathname || '/')

if (!pathname) {
return { finished: false }
Expand Down

0 comments on commit 7f7be20

Please sign in to comment.