Closed Bug 1237595 Opened 5 years ago Closed 5 years ago
Data ctor and form submission should create empty Blob/File when a input type=file is not set .
+++ This bug was initially created as a clone of Bug #1187157 +++ https://github.com/whatwg/html/issues/476 Also if this issue is not accepted, the patch restores the previous version of the testSubmission.html test and it makes everything cleaner.
Comment on attachment 8705109 [details] [diff] [review] crash3.patch I must update a couple of tests.
(In reply to Olli Pettay [:smaug] from comment #3) > So in the spec bug annevk suggested Blob and not File. I can't now recall what was the issue with Blobs and Files in FormData. There was some spec issue, or Gecko bug, do you have a link to that?
> So in the spec bug annevk suggested Blob and not File. Right, but our current implementation is not in sync with the spec. For instance, the spec says that FormDataEntryValue is (Blob or USVString) but we are still using (File or USVString). > Did you verify the submitted data stays the same with these changes? test_formSubmission checks that.
(In reply to Andrea Marchesini (:baku) from comment #5) > Bug 1162658 ok, and the spec has changed since that bug was filed. Spec isn't anymore too backwards incompatible. I wonder what to do with that and with this bug. Would it be simple change to Blob and not File, and in append call "If the filename argument is given, set value to a new File object whose contents are value and name is filename. "
Hmm, I guess the most recent patch in that bug is pretty much enough, no? and after that we could use Blob here?
What about if we finish this and then I fix File-to-Blob in bug 1162658? I don't know how much of the patch for bug 1162658 is still valid.
I guess that approach works assuming bug 1162658 gets done before the next merge.
Is it really necessary to set the filename to "blob"? When the filename isn't an empty string, PHP (and Rack, and probably other multipart decoders) seems to treat it as an actual file upload (it creates the temp file, sets the error code to OK, etc...). Submitting the form normally (without FormData/xhr) does use an empty string for the filename though, which PHP ignores as it should.
Maxime, by spec, this is what we should implement. But I filed a bug last week just to change this 'blob' filename issue. Actually, I also implemented the new version of the spec removing this 'blob' filename: bug 1241171. I'm going to land that patch on monday.
Setting the filename to "blob" breaks sites existing sites since there is no longer a way of distinguishing between no file having been selected and an empty file named "blob". From https://boards.4chan.org/qa/thread/418502: > On nightly, if you post without an image using quick reply, it complains about the file size.
You need to log in before you can comment on or make changes to this bug.