-
Notifications
You must be signed in to change notification settings - Fork 141
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
Web reality: Filenames should be newline-normalized in urlencoded #562
Comments
To clarify a bit the reasoning for why this normalization must happen in the When constructing an entry list from a When encoding an entry list as When encoding an entry list as Since all browsers agree that newlines in filenames get normalized, this should be incorporated into the specs, and since in the Chrome/spec behavior filenames don't get normalized in |
It seems to the flattening from File to string would have to happen in HTML then, so we keep all the normalization there. (If that is actually how it works we can also simplify the serialization defined here in URL as value would always be a string.) To verify testing |
So under this new behavior, constructing the entry list would depend on the form method: for |
Yeah, it's a little unfortunate, but it also seems quite reasonable as there is no real reason for urlencoded and text/plain to have to deal with files. |
Around the time of the last post so far in this thread, @annevk and I reasoned on IRC that it was fine for "constructing the entry list" to depend on the form's enctype (with Unfortunately, when I was working on a PR, I noticed two APIs that make it possible for an entry list constructed as
I'll be adding tests to web-platform-tests/wpt#26740 to figure out what browsers do in each case. Also, this issue should be probably moved to HTML. |
So the problem here is that the URL Standard (and urlencoded in particular) would still be able to get cc @whatwg/forms |
A |
I've been testing the behavior of browsers in several combination of cases. Some of the features I was testing weren't available in all browsers. In particular:
Browsers treat "string/ "Normalized" here means following the normalization in the "append an entry" algorithm. When used for serializations, it means all names and values are serialized, including string values that come from filenames in the entry list.
*. Chrome treats the serialization of |
I opened whatwg/html#6247 to discuss the topic of newline normalization in forms more broadly than just for |
When entries are added to a form's entry list through the "append an entry" algorithm, their newlines are normalized, but entries can be added to an entry list through other means. This change adds a final newline normalization before serializing the form payload, since "append an entry" cannot be changed because its results are observable through the `FormData` object or through the `formdata` event. This change additionally changes the input passed to the `application/x-www-form-urlencoded` and `text/plain` serializes to be a list of name-value pairs, where the values are strings rather than `File` objects. This simplifies the serializer algorithms. Closes whatwg#6247. Closes whatwg/url#562.
When entries are added to a form's entry list through the "append an entry" algorithm, their newlines are normalized, but entries can be added to an entry list through other means. This change adds a final newline normalization before serializing the form payload, since "append an entry" cannot be changed because its results are observable through the `FormData` object or through the `formdata` event. This change additionally changes the input passed to the `application/x-www-form-urlencoded` and `text/plain` serializers to be a list of name-value pairs, where the values are strings rather than `File` objects. This simplifies the serializer algorithms. Closes whatwg#6247. Closes whatwg/url#562.
User agents normalize newlines when serializing form data to text/plain, application/x-www-form-urlencoded, and multipart/form-data. (This can be observed through FormData or the formdata event.) This additionally changes the input passed to the application/x-www-form-urlencoded and text/plain serializers to be a list of name-value pairs, where the values are always strings rather than potentially File objects. Tests: web-platform-tests/wpt#26740. Follow-up: #6624 & #6697. Closes #6247. Helps with whatwg/url#562.
After whatwg/html#6287 no callers are left which invoke the application/x-www-form-urlencoded serializer with file values. Closes #562.
Tests: web-platform-tests/wpt#26740
All browser engines seem to be newline-normalizing filenames as if they were string values going through the same normalization as in HTML's append an entry. This is arguably a result of implementations doing the normalizing at the end (see web-platform-tests/wpt#26556, https://bugzilla.mozilla.org/show_bug.cgi?id=1657844, https://bugs.webkit.org/show_bug.cgi?id=219086), but since all browsers share it, maybe it should be fixed in spec-land. And since browsers don't newline-normalize filenames with
multipart/form-data
, it'd have to be in theurlencoded
serializer.The text was updated successfully, but these errors were encountered: