mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
fs: invalidate blob created from empty file when written to
Fixes: https://github.com/nodejs/node/issues/47161 PR-URL: https://github.com/nodejs/node/pull/47199 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
f51c152f60
commit
73645d6227
2 changed files with 20 additions and 12 deletions
|
@ -1,14 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayBuffer,
|
||||
ArrayFrom,
|
||||
MathMax,
|
||||
MathMin,
|
||||
ObjectDefineProperties,
|
||||
ObjectDefineProperty,
|
||||
PromiseReject,
|
||||
PromiseResolve,
|
||||
ReflectConstruct,
|
||||
RegExpPrototypeExec,
|
||||
RegExpPrototypeSymbolReplace,
|
||||
|
@ -266,10 +264,6 @@ class Blob {
|
|||
if (!isBlob(this))
|
||||
return PromiseReject(new ERR_INVALID_THIS('Blob'));
|
||||
|
||||
if (this.size === 0) {
|
||||
return PromiseResolve(new ArrayBuffer(0));
|
||||
}
|
||||
|
||||
const { promise, resolve, reject } = createDeferredPromise();
|
||||
const reader = this[kHandle].getReader();
|
||||
const buffers = [];
|
||||
|
@ -316,12 +310,6 @@ class Blob {
|
|||
if (!isBlob(this))
|
||||
throw new ERR_INVALID_THIS('Blob');
|
||||
|
||||
if (this.size === 0) {
|
||||
return new lazyReadableStream({
|
||||
start(c) { c.close(); },
|
||||
});
|
||||
}
|
||||
|
||||
const reader = this[kHandle].getReader();
|
||||
return new lazyReadableStream({
|
||||
start(c) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue