Explorar o código

storage-node: safe multiple calls to stream.cleanup()

Mokhtar Naamani %!s(int64=3) %!d(string=hai) anos
pai
achega
a356c311d9
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      storage-node/packages/storage/storage.js

+ 2 - 0
storage-node/packages/storage/storage.js

@@ -183,6 +183,8 @@ class StorageWriteStream extends Transform {
    * Clean up temporary data.
    */
   cleanup() {
+    // Make it safe to call cleanup more than once
+    if (!this.temp) return
     debug('Cleaning up temporary file: ', this.temp.path)
     fs.unlink(this.temp.path, () => {
       /* Ignore errors. */