소스 검색

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

Mokhtar Naamani 3 년 전
부모
커밋
a356c311d9
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  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. */