fix(config): keep '=' inside the value of config set - #411
Open
JspIIV wants to merge 1 commit into
Open
Conversation
keyValue.split("=") destructures only the first two parts, so a value
containing "=" was silently truncated at the first one. base64 padding
and URLs with a query string are the common cases:
config set apiKey=YWJjZGVm== stored YWJjZGVm
config set rpcUrl=https://x/v1?key=a&m=fast stored https://x/v1?key
Splits on the first separator instead. An empty value and a missing
separator behave as before.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
config setdestructures the split, so it only ever keeps the first two parts:A value containing
=is silently truncated at the first one. Two everyday cases:There is no error and no warning. The command reports
Configuration successfully updated, and the value only turns out to be wrong later, when whatever reads it fails for a reason that does not point back here.Change
Splits on the first separator instead:
The two existing behaviours are unchanged:
config set invalidFormat) still fails withInvalid format. Use 'key=value'.config set defaultNetwork=) still stores""Tests
Three cases added to
tests/actions/getSetReset.test.ts: base64 padding, a query string, and the empty value. The first two fail onv0.40-devand pass with the change; the empty-value and invalid-format tests pass either way, which is what pins the unchanged behaviour.Verification
Run against
v0.40-devate822a9e:And with the fix reverted, to confirm the new tests actually catch it:
Branch
Targeting
v0.40-devas the active integration branch perdocs/BRANCHING.md. Happy to retarget at a stable branch if you would rather ship it directly.One thing I left alone
reset()has adelete config[key]that operates on a local copy and is never written back — the removal actually happens becausewriteConfig(key, undefined)makesJSON.stringifydrop the key. It works, so I did not touch it here, butremoveConfig(key)already exists and says it directly. Happy to send that separately if it is worth having.