From cab730c4ee27b2100b30e8d28de56d1ec83b47ce Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 17 Jan 2020 10:39:45 -0600 Subject: [PATCH] Update to re-use toRoute method --- packages/next/next-server/lib/router/router.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/next/next-server/lib/router/router.ts b/packages/next/next-server/lib/router/router.ts index a10aa93906c3..0abdad552fbd 100644 --- a/packages/next/next-server/lib/router/router.ts +++ b/packages/next/next-server/lib/router/router.ts @@ -666,12 +666,7 @@ export default class Router implements BaseRouter { _getStaticData = (asPath: string, _cachedData?: object): Promise => { let pathname = parse(asPath).pathname - pathname = !pathname || pathname === '/' ? '/index' : pathname - - // remove trailing slash from path - if (pathname.substr(pathname.length - 1) === '/') { - pathname = pathname.substr(0, pathname.length - 1) - } + pathname = toRoute(!pathname || pathname === '/' ? '/index' : pathname) return process.env.NODE_ENV === 'production' && (_cachedData = this.sdc[pathname])