fix: upload: resuming and then cancelling should not remove the temp file immediately

Massimo Melina committed Sep 26, 2024 at 23:59 UTC 28844a2df9473e56cf60a205b3e230a2820667a6
1 file changed +1 -1
src/upload.ts
+1 -1
@@ -140,7 +140,7 @@ export function uploadWriter(base: VfsNode, path: string, ctx: Koa.Context) {
140 writeStream.once('close', async () => {
141 try {
142 if (ctx.req.aborted) {
143 - if (resumable) // we don't want to be left with 2 temp files
143 + if (resumable && !resuming) // we don't want to be left with 2 temp files
144 return delayedDelete(tempName, 0)
145 const sec = deleteUnfinishedUploadsAfter.get()
146 return _.isNumber(sec) && delayedDelete(tempName, sec)