[Webkit-unassigned] [Bug 185416] Empty <input type=file> is represented incorrectly in FormData

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Nov 16 15:56:30 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=185416

Darin Adler <darin at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darin at apple.com

--- Comment #7 from Darin Adler <darin at apple.com> ---
Comment on attachment 444343
  --> https://bugs.webkit.org/attachment.cgi?id=444343
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=444343&action=review

> Source/WebCore/html/FileInputType.cpp:189
> +        auto file = File::create(
> +            document,
> +            Blob::create(document, { }, "application/octet-stream"),
> +            emptyString());

This vertical formatting is not normally WebKit coding style, although it is technically allowed. I would prefer not to switch to it.

Writing "application/octet-stream" here isn’t as good as the WebCore::defaultMIMEType() function, which is more efficient than creating a string from a C literal each time, and it's also good to not have to worry about typos. We should use that function here.

As a follow-up, someone should also use that function in at least: WebCore::FileReaderLoader::convertToDataURL, WebCore::FormData::appendMultiPartFileValue, WebCore::XMLHttpRequest::overrideMimeType, and WebKit::LegacyDownloadClient::legacyDidStart. And we should also consider making a function for comparing the string for use in suggestedFilenameWithMIMEType and WebKit::NetworkResourceLoader::didReceiveResponse.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211116/2edce30e/attachment.htm>


More information about the webkit-unassigned mailing list