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

Boundary includes uppercase. Chrome always lowercases Blob.type. #17

Closed
d11wtq opened this issue Mar 28, 2017 · 2 comments · Fixed by #18
Closed

Boundary includes uppercase. Chrome always lowercases Blob.type. #17

d11wtq opened this issue Mar 28, 2017 · 2 comments · Fixed by #18

Comments

@d11wtq
Copy link
Contributor

d11wtq commented Mar 28, 2017

I'm running into issues using this Polyfill to upload files in Chrome (possibly all WebKit). The server (a Rack server in Ruby) complains that the response is invalid, since it cannot find any multipart boundaries. A EOFError is raised during request body parsing.

It turns out this is due to the following code:

https://github.com/jimmywarting/FormData/blob/master/FormData.js#L227

Which looks completely correct to me, however, in Chrome this causes the request body to use uppercase + lowercase characters, while the actual content type of the generated Blob is forced to lowercase, thus producing an invalid request. I was able to fix this by simply patching FormData to only use a lower case boundary.

Notice the console.log output of the Blob itself and the contents of the Blob.

image

@d11wtq d11wtq changed the title Boundary includes uppercase. Chrome lowercases Blob.type 💥 Boundary includes uppercase. Chrome always lowercases Blob.type. Mar 28, 2017
@d11wtq
Copy link
Contributor Author

d11wtq commented Mar 28, 2017

See #18.

@mryellow
Copy link

Frankly this MUST be a bug in the specs. They shouldn't be messing with the case of header content.

Can't believe no one else has noticed.

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 a pull request may close this issue.

2 participants