ignore case in protected route matching to fit OneDrive preference
Close #734
This commit is contained in:
parent
9af1ef4f47
commit
677287d3e2
1 changed files with 3 additions and 2 deletions
|
@ -83,11 +83,12 @@ export async function getAccessToken(): Promise<string> {
|
||||||
*/
|
*/
|
||||||
export function getAuthTokenPath(path: string) {
|
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.
|
||||||
path += '/'
|
// Since OneDrive ignores case, lower case before comparing. Same for protectedRoutes.
|
||||||
|
path = path.toLowerCase() + '/'
|
||||||
const protectedRoutes = siteConfig.protectedRoutes
|
const protectedRoutes = siteConfig.protectedRoutes
|
||||||
let authTokenPath = ''
|
let authTokenPath = ''
|
||||||
for (let r of protectedRoutes) {
|
for (let r of protectedRoutes) {
|
||||||
r = r.replace(/\/$/, '') + '/'
|
r = r.toLowerCase().replace(/\/$/, '') + '/'
|
||||||
if (path.startsWith(r)) {
|
if (path.startsWith(r)) {
|
||||||
authTokenPath = `${r}/.password`
|
authTokenPath = `${r}/.password`
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue