Skip to content

Commit f155bbc

Browse files
authored
Merge pull request #1042 from nextcloud-libraries/fix/OC-Chunked
2 parents 851f87b + e8630b8 commit f155bbc

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/uploader.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,18 @@ export class Uploader {
223223
// Update upload progress on chunk completion
224224
.then(() => { upload.uploaded = upload.uploaded + maxChunkSize })
225225
.catch((error) => {
226+
if (error?.response?.status === 507) {
227+
logger.error('Upload failed, not enough space on the server or quota exceeded. Cancelling the remaining chunks', { error, upload })
228+
upload.cancel()
229+
upload.status = UploadStatus.FAILED
230+
throw error
231+
}
232+
226233
if (!(error instanceof CanceledError)) {
227-
logger.error(`Chunk ${chunk + 1} ${bufferStart} - ${bufferEnd} uploading failed`)
234+
logger.error(`Chunk ${chunk + 1} ${bufferStart} - ${bufferEnd} uploading failed`, { error, upload })
235+
// TODO: support retrying ?
236+
// https://github.com/nextcloud-libraries/nextcloud-upload/issues/5
237+
upload.cancel()
228238
upload.status = UploadStatus.FAILED
229239
}
230240
throw error

0 commit comments

Comments
 (0)