From 9c2755c3a71fc07323bfd26de11d0dfe0624561d Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 24 Mar 2022 18:01:51 -0400 Subject: [PATCH] Use slice in router-utils --- packages/next/server/router-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/server/router-utils.ts b/packages/next/server/router-utils.ts index 630521434fdb..c25ea5eeb572 100644 --- a/packages/next/server/router-utils.ts +++ b/packages/next/server/router-utils.ts @@ -3,7 +3,7 @@ export function replaceBasePath(pathname: string, basePath: string): string { // and doesn't contain extra chars e.g. basePath /docs // should replace for /docs, /docs/, /docs/a but not /docsss if (hasBasePath(pathname, basePath)) { - pathname = pathname.substr(basePath.length) + pathname = pathname.slice(basePath.length) if (!pathname.startsWith('/')) pathname = `/${pathname}` } return pathname