diff options
| author | Dax Raad <[email protected]> | 2025-07-10 15:38:58 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-07-10 15:38:58 -0400 |
| commit | 49de703ba11d83765d27b864d9f33250ac038364 (patch) | |
| tree | 7e3c27dbc04fb58aba364da16177a20a23649f9d | |
| parent | 22988894c86441906af0867cbf94e9d49f76db95 (diff) | |
| download | opencode-49de703ba11d83765d27b864d9f33250ac038364.tar.gz opencode-49de703ba11d83765d27b864d9f33250ac038364.zip | |
config: escape file: string content
| -rw-r--r-- | packages/opencode/src/config/config.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts index 740580d5e..2eb12804c 100644 --- a/packages/opencode/src/config/config.ts +++ b/packages/opencode/src/config/config.ts @@ -207,14 +207,14 @@ export namespace Config { return process.env[varName] || "" }) - const fileMatches = text.match(/\{file:([^}]+)\}/g) + const fileMatches = text.match(/"?\{file:([^}]+)\}"?/g) if (fileMatches) { const configDir = path.dirname(configPath) for (const match of fileMatches) { - const filePath = match.slice(6, -1) + const filePath = match.replace(/^"?\{file:/, "").replace(/\}"?$/, "") const resolvedPath = path.isAbsolute(filePath) ? filePath : path.resolve(configDir, filePath) const fileContent = await Bun.file(resolvedPath).text() - text = text.replace(match, fileContent) + text = text.replace(match, JSON.stringify(fileContent)) } } |
