Skip to content

fix(config): handle $ character with {file:} pattern#12390

Merged
rekram1-node merged 1 commit intoanomalyco:devfrom
hstove:fix/string-replacement-in-config
Feb 6, 2026
Merged

fix(config): handle $ character with {file:} pattern#12390
rekram1-node merged 1 commit intoanomalyco:devfrom
hstove:fix/string-replacement-in-config

Conversation

@hstove
Copy link
Copy Markdown
Contributor

@hstove hstove commented Feb 6, 2026

What does this PR do?

This PR fixes an issue where files containing $ would break opencode when your config used the {file:x} pattern. This is because String.prototype.replace treats $ as a replacement character, which is not what we want in this use case. This PR instead uses a replacement function, so that .replace does a "dumb" string replacement.

There is an alternative PR: #11795 . I respectfully believe that that PR's approach is flawed as it tries to escape the $, instead of just treating the $ as-is.

How did you verify your code works?

# verified that this test fails without my fix
cd packages/opencode && bun test test/config/config.test.ts

# verified that this fix works in my project where I hit this bug
bun dev -- ~/my-proj-where-i-found-this-bug

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

The following comment was made by an LLM, it may be inaccurate:

Duplicate PR Found

PR #11795: #11795

@rekram1-node
Copy link
Copy Markdown
Collaborator

/review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 6, 2026

lgtm

@rekram1-node rekram1-node merged commit 229cdaf into anomalyco:dev Feb 6, 2026
7 checks passed
Colin4k1024 pushed a commit to Colin4k1024/opencode that referenced this pull request Feb 10, 2026
schneiderlo pushed a commit to schneiderlo/opencode that referenced this pull request Feb 17, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants