fix protectedRoutes type error, close #736

This commit is contained in:
spencerwooo
2022-08-04 21:51:42 +08:00
parent 99d1a1efbd
commit 250b5e683c
+2 -1
View File
@@ -85,9 +85,10 @@ export function getAuthTokenPath(path: string) {
// Ensure trailing slashes to compare paths component by component. Same for protectedRoutes. // Ensure trailing slashes to compare paths component by component. Same for protectedRoutes.
// Since OneDrive ignores case, lower case before comparing. Same for protectedRoutes. // Since OneDrive ignores case, lower case before comparing. Same for protectedRoutes.
path = path.toLowerCase() + '/' path = path.toLowerCase() + '/'
const protectedRoutes = siteConfig.protectedRoutes const protectedRoutes = siteConfig.protectedRoutes as string[]
let authTokenPath = '' let authTokenPath = ''
for (let r of protectedRoutes) { for (let r of protectedRoutes) {
if (typeof r !== 'string') continue
r = r.toLowerCase().replace(/\/$/, '') + '/' r = r.toLowerCase().replace(/\/$/, '') + '/'
if (path.startsWith(r)) { if (path.startsWith(r)) {
authTokenPath = `${r}.password` authTokenPath = `${r}.password`