Bladeren bron

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 jaar geleden
bovenliggende
commit
bc23c5b9fe
1 gewijzigde bestanden met toevoegingen van 1 en 1 verwijderingen
  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 {};
             },