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

dropbox: use much less memory when uploading small files - fixes #9685

Nick Craig-Wood71a173472b6e
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go
index 556a3c520..bb2f62449 100644
--- a/backend/dropbox/dropbox.go
+++ b/backend/dropbox/dropbox.go
@@ -2042,7 +2042,11 @@ func (o *Object) uploadChunked(ctx context.Context, in0 io.Reader, commitInfo *f
// write chunks
in := readers.NewCountingReader(in0)
- buf := make([]byte, int(chunkSize))
+ bufSize := chunkSize
+ if size >= 0 && size < bufSize {
+ bufSize = size
+ }
+ buf := make([]byte, int(bufSize))
cursor := files.UploadSessionCursor{
SessionId: res.SessionId,
Offset: 0,