fix: PowerShell Add-ToUserPath corrupts PATH when single entry exists#1000
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughUpdated PATH parsing in a PowerShell installation script to explicitly wrap the split-and-filter operation result in an array constructor, ensuring the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
…idation (coleam00#1000) The generate-yaml node prompt contained $nodeId.output and $other-node.output as documentation examples. The DAG validator's regex matched these as real node references and rejected the workflow. Wrap placeholders in angle brackets ($<nodeId>.output) so the regex no longer matches them. Fixes coleam00#1000
…idation (coleam00#1000) The generate-yaml node prompt contained $nodeId.output and $other-node.output as documentation examples. The DAG validator's regex matched these as real node references and rejected the workflow. Wrap placeholders in angle brackets ($<nodeId>.output) so the regex no longer matches them. Fixes coleam00#1000
…idation (coleam00#1000) The generate-yaml node prompt contained $nodeId.output and $other-node.output as documentation examples. The DAG validator's regex matched these as real node references and rejected the workflow. Wrap placeholders in angle brackets ($<nodeId>.output) so the regex no longer matches them. Fixes coleam00#1000
Bug: PowerShell
Add-ToUserPathcorrupts PATH when only one entry existsProblem
When the user PATH contains exactly one entry, the following line returns a plain string instead of an array:
PowerShell only returns an array from a pipeline when there are 2 or more elements. With a single element,
$pathPartsis typed as a[string].This causes the next line to behave as string concatenation instead of array append:
The resulting PATH becomes corrupted:
Affected scenario
This bug only triggers when the Windows user PATH contains exactly one entry — which is common on freshly configured machines or minimal environments.
Fix
Wrap the pipeline in
@()to force an array regardless of the number of elements:Testing
To reproduce and verify the fix:
Summary by CodeRabbit