Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

filen: fix potential panic in case of error during upload

Enduriel88b484722a3f
diff --git a/backend/filen/filen.go b/backend/filen/filen.go
index 72095d39d..c3d3736ee 100644
--- a/backend/filen/filen.go
+++ b/backend/filen/filen.go
@@ -415,13 +415,13 @@ func (cw *chunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader i
return totalWritten, err
}
resp, err := cw.filen.UploadChunk(ctx, &cw.FileUpload, realChunkNumber, chunkReadSlice)
+ if err != nil {
+ return totalWritten, err
+ }
select { // only care about getting this once
case cw.bucketAndRegion <- *resp:
default:
}
- if err != nil {
- return totalWritten, err
- }
totalWritten += int64(len(chunkReadSlice))
realChunkNumber++
}