fix(auth): normalize trailing slashes in auth login URLs (#15874)

This commit is contained in:
Matt Silverlock
2026-03-03 13:35:49 -05:00
committed by GitHub
parent 1663c11f40
commit 74ebb4147f
5 changed files with 140 additions and 10 deletions

View File

@@ -56,13 +56,18 @@ export namespace Auth {
}
export async function set(key: string, info: Info) {
const normalized = key.replace(/\/+$/, "")
const data = await all()
await Filesystem.writeJson(filepath, { ...data, [key]: info }, 0o600)
if (normalized !== key) delete data[key]
delete data[normalized + "/"]
await Filesystem.writeJson(filepath, { ...data, [normalized]: info }, 0o600)
}
export async function remove(key: string) {
const normalized = key.replace(/\/+$/, "")
const data = await all()
delete data[key]
delete data[normalized]
await Filesystem.writeJson(filepath, data, 0o600)
}
}