Version
24.14.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Since fs.openAsBlob doesn't support large files, I decided to rewrite the File.stream function, but the result was unexpected.
class MyFile extends File {
constructor() {
super(["1"], "test.txt", { type: "text/plain" });
}
stream() {
return new Response("2").body;
}
}
async function f1() {
const file = new MyFile();
const form = new FormData();
form.append("file", file, "othername.txt");
const resp = new Response(form);
console.log(await resp.text());
}
async function f2() {
const file = new MyFile();
const form = new FormData();
form.append("file", file);
const resp = new Response(form);
console.log(await resp.text());
}
console.log(await f1()); // MyFile.stream has not been called, file content is "1"
console.log(await f2()); // MyFile.stream was called, file content is "2"
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
The expected output of file content will be the same.
What do you see instead?
The content of the file has changed after being assigned a new name.
Additional information
No response
Version
24.14.0
Platform
Subsystem
No response
What steps will reproduce the bug?
Since fs.openAsBlob doesn't support large files, I decided to rewrite the File.stream function, but the result was unexpected.
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
The expected output of file content will be the same.
What do you see instead?
The content of the file has changed after being assigned a new name.
Additional information
No response