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