Skip to content

fix: normalizes the path to POSIX format - #8737

Open
Apoorv012 wants to merge 9 commits into
usebruno:mainfrom
Apoorv012:bugfix/windows-path-compatibility
Open

fix: normalizes the path to POSIX format#8737
Apoorv012 wants to merge 9 commits into
usebruno:mainfrom
Apoorv012:bugfix/windows-path-compatibility

Conversation

@Apoorv012

@Apoorv012 Apoorv012 commented Jul 22, 2026

Copy link
Copy Markdown

Description

Issue Resolved: #8728

It was using path.join() which was joining windows path current/directory and relative\path\file.txt resulting in current/directory/relative\path\file.txt and 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:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Bug Fixes
    • Improved file upload reliability across operating systems by normalizing user-provided file paths before validation and upload preparation.
    • Upload handling now consistently supports Windows-style backslashes and trimmed paths, reducing failures from mixed environment references.
    • File path selection in multipart/form requests now derives paths relative to the collection base more consistently, improving duplicate detection and updates.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: aca5d5b6-4351-4e7d-8946-aefb8b11ce1f

📥 Commits

Reviewing files that changed from the base of the PR and between 6068739 and ce36999.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/RequestPane/FileBody/index.js
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-cli/src/runner/prepare-request.js
  • packages/bruno-cli/src/utils/form-data.js
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/bruno-app/src/components/RequestPane/FileBody/index.js
  • packages/bruno-cli/src/utils/form-data.js
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-cli/src/runner/prepare-request.js

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

File 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.

Changes

File upload path normalization

Layer / File(s) Summary
Normalize uploaded file paths
packages/bruno-app/src/components/RequestPane/FileBody/index.js, packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js, packages/bruno-cli/src/runner/prepare-request.js, packages/bruno-cli/src/utils/form-data.js
GUI file inputs and multipart selections store normalized paths. CLI request preparation and form-data creation normalize paths before resolution and file access.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ce369

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

Backslashes turn and paths align,
Files cross platforms line by line.
Streams open where they belong,
Requests carry paths along.
Normalized paths keep uploads strong.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: normalizing file paths to POSIX format for cross-platform handling.
Linked Issues check ✅ Passed The changes address issue #8728 by normalizing Windows-style paths in the CLI and GUI before path resolution and storage. This supports running Windows-created collection files on Linux CI.
Out of Scope Changes check ✅ Passed All changed files directly support cross-platform file path normalization described in issue #8728. No unrelated changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/bruno-cli/src/runner/prepare-request.js (1)

409-410: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for Windows-style relative paths.

Test relative\\path\\file.txt in both file-body preparation and multipart form-data creation, asserting it resolves under collectionPath as relative/path/file.txt before file access. This protects the cross-layer contract from future drift.

  • packages/bruno-cli/src/runner/prepare-request.js#L409-L410: cover readFileSync and createReadStream.
  • packages/bruno-cli/src/utils/form-data.js#L29-L30: cover multipart createReadStream.
🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4f02e61 and ac67248.

📒 Files selected for processing (2)
  • packages/bruno-cli/src/runner/prepare-request.js
  • packages/bruno-cli/src/utils/form-data.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/bruno-cli/src/utils/form-data.js Outdated
Comment on lines 409 to 413
// Normalize to POSIX format for cross-platform compatibility
filePath = path.posix.normalize(filePath.replace(/\\/g, '/'));
if (!path.isAbsolute(filePath)) {
filePath = path.join(collectionPath, filePath);
}
Apoorv012 and others added 3 commits July 22, 2026 23:00
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@PiotrMachowski

Copy link
Copy Markdown

#8728 (comment)

@Apoorv012

Copy link
Copy Markdown
Author

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!

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files added to the request body on Windows GUI will not work when running collection on Linux CI

4 participants