Skip to content

Commit

Permalink
Merge pull request #1042 from nextcloud-libraries/fix/OC-Chunked
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Jan 10, 2024
2 parents 851f87b + e8630b8 commit f155bbc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,18 @@ export class Uploader {
// Update upload progress on chunk completion
.then(() => { upload.uploaded = upload.uploaded + maxChunkSize })
.catch((error) => {
if (error?.response?.status === 507) {
logger.error('Upload failed, not enough space on the server or quota exceeded. Cancelling the remaining chunks', { error, upload })
upload.cancel()
upload.status = UploadStatus.FAILED
throw error
}

if (!(error instanceof CanceledError)) {
logger.error(`Chunk ${chunk + 1} ${bufferStart} - ${bufferEnd} uploading failed`)
logger.error(`Chunk ${chunk + 1} ${bufferStart} - ${bufferEnd} uploading failed`, { error, upload })
// TODO: support retrying ?
// https://github.com/nextcloud-libraries/nextcloud-upload/issues/5
upload.cancel()
upload.status = UploadStatus.FAILED
}
throw error
Expand Down

0 comments on commit f155bbc

Please sign in to comment.