浏览代码

LibWeb: Append the bytes of File objects in submitted form data

This is required to upload files to GitHub. Unfortunately, this is not
currently testable with our test infrastructure. This path is only hit
from HTTP/S uploads, whereas all of our tests are limited to file://.
Timothy Flynn 1 年之前
父节点
当前提交
bc23c5b9fe
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp

+ 1 - 1
Userland/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp

@@ -270,7 +270,7 @@ ErrorOr<SerializedFormData> serialize_to_multipart_form_data(Vector<XHR::FormDat
                 TRY(builder.try_append(TRY(String::formatted("Content-Disposition: form-data; name=\"{}\"; filename=\"{}\"\r\n", escaped_name, escaped_filename))));
                 // The parts of the generated multipart/form-data resource that correspond to file fields must have a `Content-Type` header specified.
                 TRY(builder.try_append(TRY(String::formatted("Content-Type: {}\r\n\r\n", file->type()))));
-                // FIXME: Serialize the contents of the file.
+                TRY(builder.try_append(file->bytes()));
                 TRY(builder.try_append("\r\n"sv));
                 return {};
             },