Skip to content

feat: multi-file upload in multipart form body - #7971

Merged
sid-bruno merged 12 commits into
usebruno:mainfrom
pooja-bruno:feat/multipart-multi-file-upload
May 21, 2026
Merged

sid-bruno merged 12 commits into
usebruno:mainfrom
pooja-bruno:feat/multipart-multi-file-upload

Conversation

@pooja-bruno

@pooja-bruno pooja-bruno commented May 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Upgrades the multipart form body UI to support multi-file uploads properly.

JIRA

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.

Screen.Recording.2026-05-11.at.3.33.04.PM.mov

Summary by CodeRabbit

  • New Features

    • Multipart form files now display as editable chips with per-file add/remove, overflow dropdown, and upload button in edit mode.
    • File selection now merges/deduplicates files, normalizes paths relative to collections, and auto-determines multipart content type; removing the last file converts the field back to text.
    • Response examples and request panes updated to use the chip-based file UI; upload controls hidden in read-only mode.
  • Tests

    • Added fixtures and end-to-end tests covering multi-file upload, chip rendering, overflow behavior, and per-file removal.
  • Utilities

    • Added auto content-type detection for multipart file lists.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

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

Walkthrough

Adds a chip-based multi-file UI for multipart form params with responsive chip truncation (ResizeObserver), per-file removal, overflow dropdown, multi-select browse with path normalization and dedupe/merge, a multipart content-type helper, and Playwright/Jest tests and fixtures.

Changes

Multipart File Chips UI with Multiple File Support

Layer / File(s) Summary
Chip & Overflow Styling
packages/bruno-app/src/components/MultipartFileChipsCell/StyledWrapper.js, packages/bruno-app/src/components/RequestPane/MultipartFormParams/StyledWrapper.js, packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js
Adds Wrapper chip-row styles and exported OverflowList for overflow rows; updates .upload-btn/.clear-file-btn flex rules and file-value cell styles to match chip layout.
FileChipsCell: helpers & sizing constants
packages/bruno-app/src/components/MultipartFileChipsCell/index.js
Adds basename helper and chip sizing/reserved-space constants for visible-chip calculations.
MultipartFileChipsCell rendering & overflow logic
packages/bruno-app/src/components/MultipartFileChipsCell/index.js
New component measuring available width with ResizeObserver, rendering visible chips, collapsed summary, overflow dropdown, per-chip remove buttons, and conditional upload button.
RequestPane: imports, browse & merge logic
packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
Replaces single-file display with MultipartFileChipsCell; adds getFileList, handleBrowseFiles (multi-select, relative-path normalize, merge/dedupe), handleRemoveFile (per-file removal + downgrade to text), and data-testid on upload.
ResponseExample: imports, browse, merge, removal
packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
Mirrors RequestPane changes: chip UI integration, multi-select browse with relative-path conversion, contentType recomputation, per-file removal, and editMode-controlled upload button.
Tests
tests/request/multipart-form/multipart-form-file-chips.spec.ts
Adds tests that create temp files, mock Electron file dialog, reset rows, upload multiple files, read chip names across inline/collapsed/overflow modes, and remove a single file by name.
Fixtures & Response Tests
tests/response-examples/fixtures/collection/multipart-example.bru, tests/response-examples/multipart-form-chips.spec.ts
Adds BRU fixture for a three-file multipart example and Playwright tests verifying read-only and edit-mode chip rendering and upload control visibility.
Multipart content-type helper & tests
packages/bruno-app/src/utils/common/multipartContentType.js, packages/bruno-app/src/utils/common/multipartContentType.spec.js
Adds getMultipartAutoContentType(files) with single-file MIME detection and multipart/mixed fallback, plus unit tests covering edge cases and multi-file scenarios.

Sequence Diagram(s)

sequenceDiagram
  participant UI as MultipartFileChipsCell (UI)
  participant Dialog as Electron dialog.showOpenDialog
  participant Collection as Collection (collection.pathname)
  participant Store as Request/Row state

  UI->>Dialog: browseFiles([], ['multiSelections'])
  Dialog-->>UI: selected absolute file paths
  UI->>Collection: getRelativePath(selectedPath, collection.pathname)
  Collection-->>UI: relative paths (when possible)
  UI->>Store: merge/dedupe existing files + new relative paths (update param)
  Store-->>UI: updated file list (render chips / overflow)
  UI->>Store: onRemove(filePath) -> remove single path (downgrade to text if empty)
  Store-->>UI: updated file list (re-render)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

size/XL

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno
  • sid-bruno

Chips pop like nodes on a row,
ResizeObserver counts what can show,
Select, merge, dedupe, then display,
Remove one chip — the rest stay,
Overflow tucked in a neat dropdown glow.

🚥 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 PR title accurately describes the main feature: adding multi-file upload support to the multipart form body, which is the primary change across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js (1)

213-247: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Selecting more files overwrites previous selection (and cancel wipes it too).

Two real problems here that don’t exist in the sibling ResponseExampleMultipartFormParams.handleBrowseFiles:

  1. No merge/dedupe. When a user has already picked files and opens the dialog again to add more, processedPaths replaces the row’s existing value outright. Users will reasonably expect adding files, not swapping them. The ResponseExample variant already merges + dedupes — please mirror that.
  2. No cancel guard. If the user cancels the dialog (or selects nothing), filePaths is [], processedPaths is [], and the row is set to { type: 'file', value: [] }. That clobbers any previously selected files purely from opening and cancelling the picker. The ResponseExample variant guards with an early-return; this one should too.

Bonus: the ResponseExample variant also auto-derives contentType from the first file via mime-types/path.extname when none is set. Worth aligning so request-pane and example-pane behave identically.

🐛 Proposed fix (merge + cancel guard; optionally mirror content-type detection)
   const handleBrowseFiles = useCallback((row, onChange) => {
     dispatch(browseFiles([], ['multiSelections']))
       .then((filePaths) => {
+        if (!Array.isArray(filePaths) || filePaths.length === 0) return;
+
         const processedPaths = filePaths.map((filePath) => {
           const collectionDir = collection.pathname;
           if (filePath.startsWith(collectionDir)) {
             return path.relative(collectionDir, filePath);
           }
           return filePath;
         });

         const currentParams = item.draft
           ? get(item, 'draft.request.body.multipartForm')
           : get(item, 'request.body.multipartForm');
-        const existsInParams = (currentParams || []).some((p) => p.uid === row.uid);
+        const existingParam = (currentParams || []).find((p) => p.uid === row.uid);
+        const existingValue = existingParam && existingParam.type === 'file' && Array.isArray(existingParam.value)
+          ? existingParam.value
+          : [];
+        const merged = [...existingValue];
+        for (const p of processedPaths) {
+          if (!merged.includes(p)) merged.push(p);
+        }
         let updatedParams;
-        if (existsInParams) {
+        if (existingParam) {
           updatedParams = currentParams.map((p) => {
             if (p.uid === row.uid) {
-              return { ...p, type: 'file', value: processedPaths };
+              return { ...p, type: 'file', value: merged };
             }
             return p;
           });
         } else {
           updatedParams = [
             ...(currentParams || []),
-            { uid: row.uid, name: row.name || '', enabled: true, type: 'file', value: processedPaths, contentType: '' }
+            { uid: row.uid, name: row.name || '', enabled: true, type: 'file', value: merged, contentType: '' }
           ];
         }
         handleParamsChange(updatedParams);
       })
       .catch((error) => {
         console.error(error);
       });
   }, [dispatch, collection.pathname, item, handleParamsChange]);
🤖 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-app/src/components/RequestPane/MultipartFormParams/index.js`
around lines 213 - 247, handleBrowseFiles currently replaces the row's file list
and also clobbers it if the picker is cancelled; change it to early-return when
filePaths is empty (or undefined) to avoid wiping previous selections, and
instead of overwriting when existsInParams is true, merge processedPaths with
the existing p.value and dedupe (e.g., concat existing p.value and
processedPaths then filter unique) before setting p.type='file' and p.value to
the merged array; when creating a new param entry, set value to the
processedPaths (non-empty) and derive contentType from the first file if
contentType is falsy by using path.extname + mime-types lookup to mirror
ResponseExampleMultipartFormParams behavior, then call handleParamsChange with
the updatedParams.
🧹 Nitpick comments (7)
packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js (2)

142-143: 💤 Low value

Empty <div className="file-chips-row" /> in the collapsed branch.

This renders an empty flex row alongside the summary dropdown. If it’s there to preserve cell width/flex layout, a brief inline comment would help; otherwise it can be removed.

🤖 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-app/src/components/RequestPane/MultipartFormParams/index.js`
around lines 142 - 143, The empty self-closing div with className
"file-chips-row" in the collapsed branch of the MultipartFormParams component is
rendering an unnecessary flex row; either remove this element or replace it with
a clear intent comment/placeholder. Locate the collapsed render branch (around
the JSX that returns the summary dropdown and the empty <div
className="file-chips-row" />) and: if the element is not required for layout,
delete it; if it is required to preserve spacing, add a brief inline comment
like "preserve flex spacing for summary" or replace it with a semantic spacer
element (e.g., a <div aria-hidden> spacer) and ensure it has explanatory text in
the code next to the "file-chips-row" reference so future readers understand why
it remains.

38-69: 💤 Low value

Split this effect and memoize the files array from parent.

The observer is torn down and recreated on every render because the parent generates a fresh files array on line 306 (const files = row.type === 'file' ? getFileList(value) : []). Split into two effects: one for the observer (depends only on the DOM element), another for the compute call (depends on files.length). This keeps the observer stable and prevents unnecessary teardown cycles. Also have the parent memoize the files array so it only changes when content actually changes.

Alternatively, consider moving to a ref callback pattern with ResizeObserver for React 19 StrictMode compatibility (avoids double-invoke issues), but that's a larger refactor.

🤖 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-app/src/components/RequestPane/MultipartFormParams/index.js`
around lines 38 - 69, The current useLayoutEffect recreates the ResizeObserver
whenever the parent passes a new files array; split this into two effects: (1)
an effect that creates and manages the ResizeObserver (use the existing
containerRef and observe the td element) which should only depend on DOM refs
(no files) so the observer is stable, and (2) a separate effect that runs the
compute logic (the compute function or its body) which depends only on
files.length and calls setVisibleCount; also change the parent to memoize the
files array (the code that does const files = row.type === 'file' ?
getFileList(value) : []) so files identity only changes when content changes
(e.g., wrap getFileList result in useMemo) to avoid unnecessary recomputations.
tests/request/multipart-form/multipart-form-file-chips.spec.ts (2)

69-80: ⚡ Quick win

beforeEach only trims rows; doesn’t reset row 0’s file state.

After the first test mutates row 0 into a file-type row with chips, the loop here only deletes extra rows (rowCount > 1) and saves. The subsequent test still starts on that same file-typed row and uploads onto it. Today it passes because RequestPane overwrites with the new selection, but it’s fragile to behavior changes (e.g. if upload starts merging like the ResponseExample variant, chip counts would diverge).

Consider explicitly resetting row 0 (e.g., removing the only remaining row via the row’s remove control if available, or driving the row back to an empty/text state) so each test starts from a known-clean slate.

🤖 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 `@tests/request/multipart-form/multipart-form-file-chips.spec.ts` around lines
69 - 80, The beforeEach currently only removes extra rows and leaves row 0
potentially in a mutated file/chips state; update the setup in the
test.beforeEach (the block using
buildCommonLocators(page).table('editable-table'), table.allRows(),
table.rowDeleteButton and saveRequest) to explicitly reset the remaining row:
either remove row 0 with the table.rowDeleteButton for that row (or click the
row’s remove control) and/or drive the UI to switch row 0 back to an empty/text
type before calling saveRequest, ensuring each test starts from a known-clean
single-row state.

93-115: ⚡ Quick win

Wrap test bodies in test.step for richer reports.

Per coding guidelines, please promote test.step usage. The two test cases each have a couple of clear logical phases (upload, assert chip render; upload, remove a chip, assert) that read well as steps.

♻️ Suggested structure
   test('uploading multiple files shows one chip per file', async ({ page, electronApp }) => {
-    await uploadFiles(page, electronApp, [fileA, fileB, fileC]);
-
-    const chips = page.locator('.file-chip');
-    await expect(chips).toHaveCount(3);
-    await expect(chips.nth(0).locator('.file-chip-name')).toHaveText('alpha.txt');
-    await expect(chips.nth(1).locator('.file-chip-name')).toHaveText('beta.txt');
-    await expect(chips.nth(2).locator('.file-chip-name')).toHaveText('gamma.txt');
+    await test.step('upload three files', async () => {
+      await uploadFiles(page, electronApp, [fileA, fileB, fileC]);
+    });
+
+    await test.step('renders one chip per file with correct names', async () => {
+      const chips = page.locator('.file-chip');
+      await expect(chips).toHaveCount(3);
+      await expect(chips.nth(0).locator('.file-chip-name')).toHaveText('alpha.txt');
+      await expect(chips.nth(1).locator('.file-chip-name')).toHaveText('beta.txt');
+      await expect(chips.nth(2).locator('.file-chip-name')).toHaveText('gamma.txt');
+    });
   });

As per coding guidelines: “Promote the use of test.step as much as possible so the generated reports are easier to read”.

🤖 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 `@tests/request/multipart-form/multipart-form-file-chips.spec.ts` around lines
93 - 115, Wrap the logical phases of each test in test.step calls: for the
"uploading multiple files shows one chip per file" test, add test.step("upload
files", ...) around the uploadFiles(page, electronApp, [fileA, fileB, fileC])
call and test.step("assert chips rendered", ...) around the expectations that
reference the chips locator ('.file-chip') and the '.file-chip-name' checks; for
the "each chip can be removed individually" test, add test.step("upload files",
...) around the uploadFiles call, test.step("remove beta chip", ...) around the
chips.filter(...).locator('.file-chip-remove').click() action, and
test.step("assert remaining chips", ...) around the subsequent expectations that
use chips.filter({ hasText: ... }) and toHaveCount assertions so the report
shows upload, action, and verification phases.
packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js (2)

226-229: 💤 Low value

Dedupe is O(n²) — fine for typical inputs, but worth noting.

merged.includes(p) inside the loop is quadratic. With user-driven file pickers this will never matter, but if you ever programmatically batch-add hundreds of paths, switch to a Set:

♻️ Optional refactor
-        const merged = [...existingValue];
-        for (const p of processedPaths) {
-          if (!merged.includes(p)) merged.push(p);
-        }
+        const seen = new Set(existingValue);
+        const merged = [...existingValue];
+        for (const p of processedPaths) {
+          if (!seen.has(p)) {
+            seen.add(p);
+            merged.push(p);
+          }
+        }
🤖 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-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js`
around lines 226 - 229, The current merging loop uses merged.includes(p) causing
O(n²) behavior; change it to use a Set for O(1) membership checks: create a Set
from existingValue (e.g., const seen = new Set(existingValue)), keep merged as a
copy of existingValue, then for each p in processedPaths do if (!seen.has(p)) {
seen.add(p); merged.push(p); } — update the code around merged, existingValue,
and processedPaths accordingly to preserve original order while avoiding
quadratic checks.

29-173: 💤 Low value

Near-identical FileChipsCell duplicated with the RequestPane copy.

The whole component, basename, and the four sizing constants are duplicated between this file and packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js, modulo editMode gates. With only two consumers it’s under the “3+ places before abstracting” threshold, so leave as-is unless a third caller materializes — just keep them in sync when one side changes (e.g., the cancel-guard fix on the request side).

As per coding guidelines: “Avoid abstractions unless the exact same code is being used in more than 3 places.”

🤖 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-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js`
around lines 29 - 173, Duplicate FileChipsCell and its helpers (basename,
MIN_CHIP_W, CHIP_GAP, UPLOAD_RESERVE, MORE_CHIP_RESERVE) exist intentionally
between this component and the RequestPane MultipartFormParams copy; do not
refactor now — instead, when changing behavior (e.g., the cancel-guard fix
applied in the request-side copy) update both implementations to keep them in
sync. Locate the FileChipsCell function and the basename/constant definitions in
this file and the corresponding MultipartFormParams copy and apply identical
changes to both (preserve the editMode gating here), ensuring event handlers
(onRemove/onAdd), ResizeObserver logic, and visibleCount computation remain
consistent across the two copies.
packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js (1)

257-319: 💤 Low value

Consider extracting the duplicated OverflowList styling.

The exact same OverflowList block also lives in packages/bruno-app/src/components/RequestPane/MultipartFormParams/StyledWrapper.js. Two-place duplication is within the “3+ places before abstracting” bar, so feel free to leave it — flagging in case a third consumer appears.

As per coding guidelines: “Avoid abstractions unless the exact same code is being used in more than 3 places.”

🤖 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-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js`
around lines 257 - 319, Duplicate OverflowList styled block should be extracted
into a shared styled component: create a new exported styled component (e.g.
StyledOverflowList or OverflowListShared) in a common styles module, move the
full CSS (including .overflow-row, .overflow-row-icon, .overflow-row-name,
.overflow-row-remove and the hover/theme prop logic) into it, then replace the
local OverflowList definitions with imports of that shared component in both
places where OverflowList currently exists; ensure the theme prop usage is
preserved and update imports/exports accordingly so both StyledWrapper.js files
use the single shared OverflowList component.
🤖 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.

Inline comments:
In `@packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js`:
- Around line 23-27: The basename function can return wrong results for
mixed-separator paths; update the implementation in the basename function to use
Node's path module (e.g., path.basename) or normalize/split on both separators
instead of relying on isWindowsOS() ? '\\' : '/'. Locate the basename function
and replace the single-separator split logic with a call to
path.basename(String(filePath)) (or, if avoiding path, split on / and \\ and
take the last segment), ensuring String(filePath) is still handled and
empty/undefined inputs return '' as before.

---

Outside diff comments:
In `@packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js`:
- Around line 213-247: handleBrowseFiles currently replaces the row's file list
and also clobbers it if the picker is cancelled; change it to early-return when
filePaths is empty (or undefined) to avoid wiping previous selections, and
instead of overwriting when existsInParams is true, merge processedPaths with
the existing p.value and dedupe (e.g., concat existing p.value and
processedPaths then filter unique) before setting p.type='file' and p.value to
the merged array; when creating a new param entry, set value to the
processedPaths (non-empty) and derive contentType from the first file if
contentType is falsy by using path.extname + mime-types lookup to mirror
ResponseExampleMultipartFormParams behavior, then call handleParamsChange with
the updatedParams.

---

Nitpick comments:
In `@packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js`:
- Around line 142-143: The empty self-closing div with className
"file-chips-row" in the collapsed branch of the MultipartFormParams component is
rendering an unnecessary flex row; either remove this element or replace it with
a clear intent comment/placeholder. Locate the collapsed render branch (around
the JSX that returns the summary dropdown and the empty <div
className="file-chips-row" />) and: if the element is not required for layout,
delete it; if it is required to preserve spacing, add a brief inline comment
like "preserve flex spacing for summary" or replace it with a semantic spacer
element (e.g., a <div aria-hidden> spacer) and ensure it has explanatory text in
the code next to the "file-chips-row" reference so future readers understand why
it remains.
- Around line 38-69: The current useLayoutEffect recreates the ResizeObserver
whenever the parent passes a new files array; split this into two effects: (1)
an effect that creates and manages the ResizeObserver (use the existing
containerRef and observe the td element) which should only depend on DOM refs
(no files) so the observer is stable, and (2) a separate effect that runs the
compute logic (the compute function or its body) which depends only on
files.length and calls setVisibleCount; also change the parent to memoize the
files array (the code that does const files = row.type === 'file' ?
getFileList(value) : []) so files identity only changes when content changes
(e.g., wrap getFileList result in useMemo) to avoid unnecessary recomputations.

In
`@packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js`:
- Around line 226-229: The current merging loop uses merged.includes(p) causing
O(n²) behavior; change it to use a Set for O(1) membership checks: create a Set
from existingValue (e.g., const seen = new Set(existingValue)), keep merged as a
copy of existingValue, then for each p in processedPaths do if (!seen.has(p)) {
seen.add(p); merged.push(p); } — update the code around merged, existingValue,
and processedPaths accordingly to preserve original order while avoiding
quadratic checks.
- Around line 29-173: Duplicate FileChipsCell and its helpers (basename,
MIN_CHIP_W, CHIP_GAP, UPLOAD_RESERVE, MORE_CHIP_RESERVE) exist intentionally
between this component and the RequestPane MultipartFormParams copy; do not
refactor now — instead, when changing behavior (e.g., the cancel-guard fix
applied in the request-side copy) update both implementations to keep them in
sync. Locate the FileChipsCell function and the basename/constant definitions in
this file and the corresponding MultipartFormParams copy and apply identical
changes to both (preserve the editMode gating here), ensuring event handlers
(onRemove/onAdd), ResizeObserver logic, and visibleCount computation remain
consistent across the two copies.

In
`@packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js`:
- Around line 257-319: Duplicate OverflowList styled block should be extracted
into a shared styled component: create a new exported styled component (e.g.
StyledOverflowList or OverflowListShared) in a common styles module, move the
full CSS (including .overflow-row, .overflow-row-icon, .overflow-row-name,
.overflow-row-remove and the hover/theme prop logic) into it, then replace the
local OverflowList definitions with imports of that shared component in both
places where OverflowList currently exists; ensure the theme prop usage is
preserved and update imports/exports accordingly so both StyledWrapper.js files
use the single shared OverflowList component.

In `@tests/request/multipart-form/multipart-form-file-chips.spec.ts`:
- Around line 69-80: The beforeEach currently only removes extra rows and leaves
row 0 potentially in a mutated file/chips state; update the setup in the
test.beforeEach (the block using
buildCommonLocators(page).table('editable-table'), table.allRows(),
table.rowDeleteButton and saveRequest) to explicitly reset the remaining row:
either remove row 0 with the table.rowDeleteButton for that row (or click the
row’s remove control) and/or drive the UI to switch row 0 back to an empty/text
type before calling saveRequest, ensuring each test starts from a known-clean
single-row state.
- Around line 93-115: Wrap the logical phases of each test in test.step calls:
for the "uploading multiple files shows one chip per file" test, add
test.step("upload files", ...) around the uploadFiles(page, electronApp, [fileA,
fileB, fileC]) call and test.step("assert chips rendered", ...) around the
expectations that reference the chips locator ('.file-chip') and the
'.file-chip-name' checks; for the "each chip can be removed individually" test,
add test.step("upload files", ...) around the uploadFiles call,
test.step("remove beta chip", ...) around the
chips.filter(...).locator('.file-chip-remove').click() action, and
test.step("assert remaining chips", ...) around the subsequent expectations that
use chips.filter({ hasText: ... }) and toHaveCount assertions so the report
shows upload, action, and verification phases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: efe9e05e-c9aa-417f-83a0-b34d3a74d6f0

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad5118 and 24793a6.

📒 Files selected for processing (5)
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
  • tests/request/multipart-form/multipart-form-file-chips.spec.ts

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

Actionable comments posted: 1

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

Inline comments:
In `@packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js`:
- Around line 89-101: The multipart file param handling in MultipartFormParams
is missing automatic contentType detection, causing UX inconsistency with
ResponseExampleMultipartFormParams; update the logic in the block that
constructs updatedParams (the branch that returns { uid: row.uid, ... type:
'file', value: merged, contentType: '' } and the branch that sets type: 'file',
value: merged) to set contentType to mime.contentType(path.extname(merged[0]))
when merged is a non-empty array (falling back to '' if detection returns
falsy), and add the required imports for mime and path at the top of the file so
contentType is inferred the same way as in ResponseExampleMultipartFormParams.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7aa71e9d-708b-4194-bd38-945d2ea39430

📥 Commits

Reviewing files that changed from the base of the PR and between b151750 and 3ab57d5.

📒 Files selected for processing (7)
  • packages/bruno-app/src/components/MultipartFileChipsCell/StyledWrapper.js
  • packages/bruno-app/src/components/MultipartFileChipsCell/index.js
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/StyledWrapper.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
  • tests/request/multipart-form/multipart-form-file-chips.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/request/multipart-form/multipart-form-file-chips.spec.ts

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

Actionable comments posted: 1

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

Inline comments:
In `@tests/response-examples/multipart-form-chips.spec.ts`:
- Around line 13-14: Replace the two uses of execSync that interpolate
fixturePath with execFileSync and pass the command and arguments as arrays to
avoid shell parsing; specifically, change the execSync calls that run "git
ls-files --error-unmatch \"${fixturePath}\"" and "git checkout --
\"${fixturePath}\"" to use child_process.execFileSync('git',
['ls-files','--error-unmatch', fixturePath], { stdio: 'ignore' }) and
execFileSync('git', ['checkout','--', fixturePath], { stdio: 'ignore' })
respectively, keeping the same options (stdio: 'ignore') and referencing the
existing fixturePath variable and the execSync symbol to locate the
replacements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 13e9d575-7f1c-4b9d-ab74-75f8ca11cbef

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab57d5 and e42023b.

📒 Files selected for processing (2)
  • tests/response-examples/fixtures/collection/multipart-example.bru
  • tests/response-examples/multipart-form-chips.spec.ts
✅ Files skipped from review due to trivial changes (1)
  • tests/response-examples/fixtures/collection/multipart-example.bru

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

Actionable comments posted: 1

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

Inline comments:
In
`@packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js`:
- Around line 65-77: In handleBrowseFiles where existingValue is computed,
normalize legacy string values by checking if existingParam.value is a string
and wrapping it into an array (e.g., [existingParam.value]) before treating it
as existingValue; currently the code only handles arrays and drops single-string
legacy values, so update the logic that defines existingValue (referencing
existingParam, existingValue, processedPaths, and getMultipartAutoContentType)
to accept string or array and produce a consistent array to merge with
processedPaths.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 69e3c8eb-cf99-40b5-9497-c87b5054a167

📥 Commits

Reviewing files that changed from the base of the PR and between e42023b and a4615a4.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
  • packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
  • packages/bruno-app/src/utils/common/multipartContentType.js
  • packages/bruno-app/src/utils/common/multipartContentType.spec.js
✅ Files skipped from review due to trivial changes (2)
  • packages/bruno-app/src/utils/common/multipartContentType.js
  • packages/bruno-app/src/utils/common/multipartContentType.spec.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js

@pooja-bruno
pooja-bruno force-pushed the feat/multipart-multi-file-upload branch from e0edc10 to 2c488a4 Compare May 18, 2026 09:38
…ltipart-multi-file-upload

# Conflicts:
#	packages/bruno-app/src/components/RequestPane/MultipartFormParams/index.js
#	packages/bruno-app/src/components/ResponseExample/ResponseExampleRequestPane/ResponseExampleMultipartFormParams/index.js
@sid-bruno
sid-bruno merged commit 8cd7c26 into usebruno:main May 21, 2026
17 of 20 checks passed
lyh543 pushed a commit to lyh543/bruno that referenced this pull request May 22, 2026
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.

2 participants