ensure ctx.state.uploadDestinationPath has the tempName potentially modified by uploadStart

Massimo Melina committed Jan 5, 2026 at 19:28 UTC 0166af9b5e42a1f53d8dd3230889fcdf426564ce
1 file changed +1 -1
src/upload.ts
+1 -1
@@ -136,10 +136,10 @@ export function uploadWriter(base: VfsNode, baseUri: string, filename: string, c
136 fs.unlinkSync(tempName)
137 const writeStream = createStreamLimiter(contentLength ?? Infinity)
138 const fullSize = stillToWrite + resume
139 - ctx.state.uploadDestinationPath = tempName
139 // allow plugins to mess with the write-stream, because the read-stream can be complicated in case of multipart
140 const obj = { ctx, writeStream, fullPath, tempName, resume, fullSize, uri: '' }
141 const resEvent = events.emit('uploadStart', obj)
142 + ctx.state.uploadDestinationPath = tempName
143 if (resEvent?.isDefaultPrevented()) return
144
145 const fileStream = fs.createWriteStream(tempName, resume ? { flags: 'r+', start: resume } : undefined)