fix: (regression beta) at the end of an upload, a harmless but useless request was made, resulting in a 416 error code

Massimo Melina committed May 18, 2025 at 21:57 UTC 78d0d1ce6f359628fb962e1cf7dcda1111b8eeed
1 file changed +6 -3
frontend/src/uploadQueue.ts
+6 -3
@@ -124,9 +124,12 @@ export async function startUpload(toUpload: ToUpload, to: string, startingResume
124 else if (!status) // request failed at a network level, so try again, but not too often
125 return await wait(2000)
126 else {
127 - splitResume += splitSize || Infinity
128 - if (splitResume < fullSize) return // go on with the next chunk
129 - waitSecondChunk.resolve() // finished, there's no second chunk
127 + if (splitSize) {
128 + splitResume += splitSize
129 + if (splitResume < fullSize) return // go on with the next chunk
130 + }
131 + stopLooping = true
132 + waitSecondChunk.resolve() // we finished, no need to wait
133 uploadState.done.push({ ...toUpload, res: tryJson(req.responseText) })
134 uploadState.doneByte += toUpload!.file.size
135 reloadOnClose = true