Skip to content

Conversation

@hazelnutcloud
Copy link
Contributor

@hazelnutcloud hazelnutcloud commented Aug 20, 2024

Closes #123

Summary by CodeRabbit

  • Bug Fixes
    • Correctly processes form fields with multiple values on the server, appending each value individually.
    • Improves compatibility with backends expecting repeated keys in multipart submissions.
    • Resolves issues where array fields were previously sent as a single value, preventing missing data.
    • More reliable handling for checkboxes, multi-select inputs, and repeated parameters in server-side form submissions.

Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
Teyik0 added a commit to Teyik0/eden that referenced this pull request Apr 3, 2025
SaltyAom added a commit that referenced this pull request May 5, 2025
fix t.Files() upload from server side #124
@coderabbitai
Copy link

coderabbitai bot commented Oct 11, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Server-side multipart FormData construction now detects array field values and appends each element individually instead of appending the array as a single value. This affects handling of values like File[] during request body assembly in src/treaty2/index.ts. No exported/public signatures changed.

Changes

Cohort / File(s) Summary
Server FormData handling
src/treaty2/index.ts
Adjusted FormData building logic to check Array.isArray(value) and iterate to append each element; previous behavior appended array objects directly. Other logic unchanged.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Caller
    participant T as treaty2 (server)
    participant FB as FormData Builder
    participant FD as FormData
    participant HTTP as HTTP Client

    C->>T: invoke request with body (may include arrays e.g., File[])
    T->>FB: build multipart body
    FB->>FD: create FormData
    alt value is array
        loop for each element in array
            FB->>FD: append(key, element)
        end
    else value is single
        FB->>FD: append(key, value)
    end
    FB-->>T: FormData instance
    T->>HTTP: send request with FormData body
    HTTP-->>C: response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws at bytes in line,
Arrays now hop in single file—so fine!
Each File a carrot, crisp and neat,
Plopped in the basket, one per seat.
No blobs of blob, no tangled string—
Multipart meadows, spring-spring-spring! 🥕✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3c2548e and 89da73b.

📒 Files selected for processing (1)
  • src/treaty2/index.ts (1 hunks)

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.

@SaltyAom SaltyAom merged commit 9bba362 into elysiajs:main Oct 11, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bodies with files turns gets turned into string on server

2 participants