fix: normalizes the path to POSIX format - #8737
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. WalkthroughFile paths selected in the GUI and processed by the CLI are normalized for cross-platform request uploads. Windows separators are converted before relative-path storage, path resolution, filename extraction, and stream creation. ChangesFile upload path normalization
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change normalizes stored and resolved upload paths so Windows-created collections can run on Linux. No concrete merge-blocking risk is identified in the supplied change context. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/bruno-cli/src/runner/prepare-request.js (1)
409-410: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd regression coverage for Windows-style relative paths.
Test
relative\\path\\file.txtin both file-body preparation and multipart form-data creation, asserting it resolves undercollectionPathasrelative/path/file.txtbefore file access. This protects the cross-layer contract from future drift.
packages/bruno-cli/src/runner/prepare-request.js#L409-L410: coverreadFileSyncandcreateReadStream.packages/bruno-cli/src/utils/form-data.js#L29-L30: cover multipartcreateReadStream.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-cli/src/runner/prepare-request.js` around lines 409 - 410, Add regression tests for Windows-style relative paths at packages/bruno-cli/src/runner/prepare-request.js#L409-L410, covering both readFileSync for file bodies and createReadStream for multipart data, and assert each resolves under collectionPath as relative/path/file.txt before access. Also add coverage at packages/bruno-cli/src/utils/form-data.js#L29-L30 for multipart createReadStream, verifying the normalized POSIX path is used.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/bruno-cli/src/runner/prepare-request.js`:
- Around line 409-410: Add regression tests for Windows-style relative paths at
packages/bruno-cli/src/runner/prepare-request.js#L409-L410, covering both
readFileSync for file bodies and createReadStream for multipart data, and assert
each resolves under collectionPath as relative/path/file.txt before access. Also
add coverage at packages/bruno-cli/src/utils/form-data.js#L29-L30 for multipart
createReadStream, verifying the normalized POSIX path is used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9c2f45b8-7239-4f8e-bd15-14d02581bc82
📒 Files selected for processing (2)
packages/bruno-cli/src/runner/prepare-request.jspackages/bruno-cli/src/utils/form-data.js
There was a problem hiding this comment.
Pull request overview
This PR targets issue #8728 by normalizing Windows-style backslash file paths (stored in collections created on Windows) so that file uploads work when running the same collection on Linux CI via bruno-cli.
Changes:
- Normalize multipart form-data file paths before resolving them against
collectionPath. - Normalize “file body” upload paths before resolving them against
collectionPath.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/bruno-cli/src/utils/form-data.js | Normalizes multipart file paths before joining with the collection root. |
| packages/bruno-cli/src/runner/prepare-request.js | Normalizes single file-body upload paths before joining with the collection root. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Normalize to POSIX format for cross-platform compatibility | ||
| filePath = path.posix.normalize(filePath.replace(/\\/g, '/')); | ||
| if (!path.isAbsolute(filePath)) { | ||
| filePath = path.join(collectionPath, filePath); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…m/Apoorv012/bruno into bugfix/windows-path-compatibility
|
Hi @lohit-bruno, Just following up on this PR. It has been open for a couple of weeks now. Whenever you get a chance, I'd really appreciate a review. Please let me know if any changes are needed. Thanks! |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Description
Issue Resolved: #8728
It was using
path.join()which was joining windows pathcurrent/directoryandrelative\path\file.txtresulting incurrent/directory/relative\path\file.txtand causing file not found error.So, I first normalized the path to POSIX format, and then joined them.
Edit: Normalized file paths to POSIX format (forward slashes) at save time in the GUI as well. So this fixes the issue at source.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit