mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibWeb: Do not blindly create File objects when adding FormData entries
We were unconditionally creating new File objects for all Blob-type values passed to `FormData.append`. We should only do so if the value is not already a File object (or if the `filename` attribute is present). We must also carry MIME type information forward from the underlying Blob object.
This commit is contained in:
parent
f55471333b
commit
bb38cc1010
3 changed files with 35 additions and 9 deletions
|
@ -0,0 +1,13 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const blob = new Blob(["Hi Blob!"], { type: "text/plain" });
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("test", blob, "test.txt");
|
||||
|
||||
const file = formData.get("test");
|
||||
println(`Name: ${file.name}`);
|
||||
println(`Type: ${file.type}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue