1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:24:58 +00:00

LibWeb: Set the MIME type when creating an <input> element's File list

We were passing the MIME type to the underlying Blob, but the factory
for creating a File only checks an explicit options structure.
This commit is contained in:
Timothy Flynn 2024-03-13 16:05:32 -04:00 committed by Andreas Kling
parent 0cc8698a62
commit f55471333b
3 changed files with 17 additions and 13 deletions

View file

@ -422,7 +422,11 @@ void HTMLInputElement::did_select_files(Span<SelectedFile> selected_files)
// FIXME: The FileAPI should use ByteString for file names.
auto file_name = MUST(String::from_byte_string(selected_file.name()));
auto file = MUST(FileAPI::File::create(realm(), { JS::make_handle(blob) }, file_name));
// FIXME: Fill in other fields (e.g. last_modified).
FileAPI::FilePropertyBag options {};
options.type = mime_type.essence();
auto file = MUST(FileAPI::File::create(realm(), { JS::make_handle(blob) }, file_name, move(options)));
files.unchecked_append(file);
}