Skip to content

Commit

Permalink
revert method
Browse files Browse the repository at this point in the history
  • Loading branch information
Janpot committed Jul 1, 2020
1 parent 29b0c45 commit 52f67c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions packages/next/lib/load-custom-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,19 @@ export default async function loadCustomRoutes(
? [
{
source: '/:path*/:file.:ext/',
destination: '/:path*/:file.:ext',
destination: config.basePath + '/:path*/:file.:ext',
permanent: true,
},
{
source: '/:path*/:notfile([^/.]+)',
destination: '/:path*/:notfile/',
destination: config.basePath + '/:path*/:notfile/',
permanent: true,
},
]
: [
{
source: '/:path+/',
destination: '/:path+',
destination: config.basePath + '/:path+',
permanent: true,
},
])
Expand Down
9 changes: 1 addition & 8 deletions packages/next/next-server/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ import { PagesManifest } from '../../build/webpack/plugins/pages-manifest-plugin
import { removePathTrailingSlash } from '../../client/normalize-trailing-slash'
import getRouteFromAssetPath from '../lib/router/utils/get-route-from-asset-path'

function addBasePath(path: string, basePath: string = ''): string {
return basePath ? (path === '/' ? basePath : basePath + path) : path
}

const getCustomRouteMatcher = pathMatch(true)

type NextConfig = any
Expand Down Expand Up @@ -513,10 +509,7 @@ export default class Server {
params,
parsedUrl.query
)
const updatedDestination = addBasePath(
formatUrl(parsedDestination),
this.nextConfig.basePath
)
const updatedDestination = formatUrl(parsedDestination)

res.setHeader('Location', updatedDestination)
res.statusCode = getRedirectStatus(redirectRoute as Redirect)
Expand Down

0 comments on commit 52f67c4

Please sign in to comment.