mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(opencode-config): reject redacted placeholder in raw-text config writes
This commit is contained in:
1 parent
fa2d794239
commit
24e2037b73
3 files changed
+43
-4
No files matched your search
@@ -223,6 +223,13 @@ function collectOpenCodeConfigRedactedPaths(value: unknown, basePath: string[] =
|
||||
return paths
|
||||
}
|
||||
|
||||
function assertNoOpenCodeConfigRedactedValues(value: unknown): void {
|
||||
const paths = collectOpenCodeConfigRedactedPaths(value)
|
||||
if (paths.length > 0) {
|
||||
throw new OpenCodeConfigRedactedValueError(paths)
|
||||
}
|
||||
}
|
||||
|
||||
interface MergeOpenCodeConfigValuesOptions {
|
||||
deleteNullValues?: boolean
|
||||
}
|
||||
@@ -501,13 +508,11 @@ export async function updateOpenCodeConfigFile(
|
||||
if (targetSource?.rawContent === content) {
|
||||
return toOpenCodeConfigFile(snapshot)
|
||||
}
|
||||
assertNoOpenCodeConfigRedactedValues(parseJsonc(content))
|
||||
return writeOpenCodeConfigFile(content, targetName, snapshot)
|
||||
}
|
||||
|
||||
const redactedPaths = collectOpenCodeConfigRedactedPaths(content)
|
||||
if (redactedPaths.length > 0) {
|
||||
throw new OpenCodeConfigRedactedValueError(redactedPaths)
|
||||
}
|
||||
assertNoOpenCodeConfigRedactedValues(content)
|
||||
|
||||
const invalidSources = snapshot.sources.filter((source) => !source.isValid).map((source) => source.name)
|
||||
if (invalidSources.length > 0) {
|
||||
|
||||
Reference in new issue
Block a user