Skip to content

fix: Change data type for form data chunks#6173

Open
elramen wants to merge 6 commits into
masterfrom
elramen-form-data
Open

fix: Change data type for form data chunks#6173
elramen wants to merge 6 commits into
masterfrom
elramen-form-data

Conversation

@elramen

@elramen elramen commented Jul 3, 2026

Copy link
Copy Markdown
Member

@linear-code

linear-code Bot commented Jul 3, 2026

Copy link
Copy Markdown

INGEST-991

@elramen elramen marked this pull request as ready for review July 3, 2026 10:52
@elramen elramen requested a review from a team as a code owner July 3, 2026 10:52
Comment thread relay-server/src/utils/param_parser.rs Outdated

@Dav1dde Dav1dde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is the wrong approach.

We can limit the parts to some upper bound, but that should happen in the ChunkedFormAggregator. This isn't necessary if we switch the backing data structure and how the parts are assembled from a vec to a different data structure.

@elramen elramen changed the title fix: Limit form data chunk index fix: Change data type for form data chunks Jul 6, 2026
@elramen

elramen commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

I think this is the wrong approach.

We can limit the parts to some upper bound, but that should happen in the ChunkedFormAggregator. This isn't necessary if we switch the backing data structure and how the parts are assembled from a vec to a different data structure.

Smart! Changed it now :)

@elramen elramen requested a review from Dav1dde July 6, 2026 07:58
/// Returns the string consisting of all parts.
pub fn join(&self) -> String {
self.parts.join("")
self.parts.values().copied().collect()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So the contract here is "we'll assemble your parts in ascending order", gaps are allowed?

@Dav1dde Dav1dde Jul 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is what it was before, but we could also error here when there are gaps, I think. Seems like that's a case of invalid input.

Either way seems fine for a first fix.

/// This writer is used to serialize multiple plain fields from a multipart form data request into a
/// single envelope item. Use `FormDataIter` to iterate all entries.
struct FormDataWriter {
pub struct FormDataWriter {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this just public for tests in a different module? Can the tests instead be in this module?

@elramen elramen Jul 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I like to put tests in proximity to business logic - it helps to understand the logic and reduces clutter.

If you think that I am misprioritizing here, we can change it.

/// Returns the string consisting of all parts.
pub fn join(&self) -> String {
self.parts.join("")
self.parts.values().copied().collect()

@Dav1dde Dav1dde Jul 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is what it was before, but we could also error here when there are gaps, I think. Seems like that's a case of invalid input.

Either way seems fine for a first fix.

Comment thread CHANGELOG.md Outdated
@elramen elramen requested a review from Dav1dde July 7, 2026 08:16

@Dav1dde Dav1dde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry, I thought I approved this already this morning - forgot to press the button.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants