From 250b5e683c9f6701250c2004de87d1afe6513b25 Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Thu, 4 Aug 2022 21:51:42 +0800 Subject: [PATCH] fix protectedRoutes type error, close #736 --- pages/api/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/api/index.ts b/pages/api/index.ts index 2c87feb00..506a32dc4 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -85,9 +85,10 @@ export function getAuthTokenPath(path: string) { // Ensure trailing slashes to compare paths component by component. Same for protectedRoutes. // Since OneDrive ignores case, lower case before comparing. Same for protectedRoutes. path = path.toLowerCase() + '/' - const protectedRoutes = siteConfig.protectedRoutes + const protectedRoutes = siteConfig.protectedRoutes as string[] let authTokenPath = '' for (let r of protectedRoutes) { + if (typeof r !== 'string') continue r = r.toLowerCase().replace(/\/$/, '') + '/' if (path.startsWith(r)) { authTokenPath = `${r}.password`