Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(remix-server-runtime): multi-part form data's boundary can be wrapped in quotes (") #7237

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

omelhus
Copy link

@omelhus omelhus commented Aug 23, 2023

When a multipart/form-data upload is done from .NET it wraps the value of the boundary property in the content-type header with ", like "multipart/form-data; boundary=\"--------------------------890934293568639326555573\"", and this breaks the upload in unstable_parseMultipartFormData.

Closes: Did not bother with creating an issue. Fix included in PR.

  • Docs
  • Tests

Testing Strategy:

This test covers this code: integration/form-data-multipart-test.ts

@changeset-bot
Copy link

changeset-bot bot commented Aug 23, 2023

⚠️ No Changeset found

Latest commit: 2159d47

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Aug 23, 2023

Hi @omelhus,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Aug 23, 2023

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@omelhus omelhus changed the base branch from main to dev August 23, 2023 11:36
@omelhus omelhus closed this Aug 23, 2023
@omelhus omelhus reopened this Aug 23, 2023
@omelhus
Copy link
Author

omelhus commented Aug 23, 2023

I guess you can just cherry pick the three lines to fix this :)

@omelhus omelhus changed the base branch from dev to main August 23, 2023 11:48
@MichaelDeBoey MichaelDeBoey changed the title bug: multipart with boundary wrapped with " fails fix(remix-server-runtime): multi-part form data's boundary can be wrapped in quotes (") Nov 1, 2023
Copy link
Member

@MichaelDeBoey MichaelDeBoey left a comment

Choose a reason for hiding this comment

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

@omelhus Are you still interested in getting this PR merged?
If so, could you please rebase onto latest dev and solve conflicts?

Copy link
Member

Choose a reason for hiding this comment

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

Since you created an actual file, can you please keep the original integration/bug-report-test.ts file?

"app/routes/burgers.jsx": js`
export default function Index() {
return <div>cheeseburger</div>;
"app/routes/upload.jsx": js`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"app/routes/upload.jsx": js`
"app/routes/upload.tsx": js`

export default function Index() {
return <div>cheeseburger</div>;
"app/routes/upload.jsx": js`
import { json, ActionArgs, unstable_parseMultipartFormData } from '@remix-run/node';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { json, ActionArgs, unstable_parseMultipartFormData } from '@remix-run/node';
import { json, unstable_parseMultipartFormData } from '@remix-run/node';

Comment on lines +65 to +67
const rsp = await unstable_parseMultipartFormData(request, async ({ data, filename, contentType }) => {
return filename;
});
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const rsp = await unstable_parseMultipartFormData(request, async ({ data, filename, contentType }) => {
return filename;
});
const rsp = await unstable_parseMultipartFormData(request, ({ filename }) => filename);

@MichaelDeBoey MichaelDeBoey added the needs-response We need a response from the original author about this issue/PR label Nov 1, 2023
@omelhus omelhus changed the base branch from main to dev November 1, 2023 18:13
@github-actions github-actions bot removed the needs-response We need a response from the original author about this issue/PR label Nov 1, 2023
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.

None yet

3 participants