Fix chuked file upload using a wrong work path

This commit is contained in:
SrGooglo 2025-01-25 19:42:40 +00:00
parent f99e1c0ea2
commit a7e54669f5

View File

@ -104,7 +104,8 @@ export async function handleChunkFile(
} }
) { ) {
return await new Promise(async (resolve, reject) => { return await new Promise(async (resolve, reject) => {
const chunksPath = path.join(tmpDir, headers["uploader-file-id"], "chunks") const workPath = path.join(tmpDir, headers["uploader-file-id"])
const chunksPath = path.join(workPath, "chunks")
const chunkPath = path.join(chunksPath, headers["uploader-chunk-number"]) const chunkPath = path.join(chunksPath, headers["uploader-chunk-number"])
const chunkCount = +headers["uploader-chunk-number"] const chunkCount = +headers["uploader-chunk-number"]
@ -167,7 +168,7 @@ export async function handleChunkFile(
return resolve(createAssembleChunksPromise({ return resolve(createAssembleChunksPromise({
// build data // build data
chunksPath: chunksPath, chunksPath: chunksPath,
filePath: path.resolve(chunksPath, `${filename}.${extension}`), filePath: path.resolve(workPath, `${filename}.${extension}`),
maxFileSize: maxFileSize, maxFileSize: maxFileSize,
})) }))
} }