summaryrefslogtreecommitdiffhomepage
path: root/packages/opencode/src/auth/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/opencode/src/auth/index.ts')
-rw-r--r--packages/opencode/src/auth/index.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/opencode/src/auth/index.ts b/packages/opencode/src/auth/index.ts
index 776cc99b4..80253a665 100644
--- a/packages/opencode/src/auth/index.ts
+++ b/packages/opencode/src/auth/index.ts
@@ -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)
}
}