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: remove an unnecessary API call when uploading small files - fixes #9686

Nick Craig-Woode6a2347bb39e
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go
index bb2f62449..11a3360ac 100644
--- a/backend/dropbox/dropbox.go
+++ b/backend/dropbox/dropbox.go
@@ -2051,7 +2051,12 @@ func (o *Object) uploadChunked(ctx context.Context, in0 io.Reader, commitInfo *f
SessionId: res.SessionId,
Offset: 0,
}
- appendArg := files.UploadSessionAppendArg{Cursor: &cursor}
+ appendArg := files.UploadSessionAppendArg{
+ Cursor: &cursor,
+ // A known-size upload which fits in a single chunk can close the
+ // session with its only append, saving an empty append request
+ Close: size >= 0 && size <= chunkSize,
+ }
for currentChunk := 1; ; currentChunk++ {
cursor.Offset = in.BytesRead()