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

yandex: fix missing MD5 hash after uploading a file

Nick Craig-Wood0efafc5210e0
diff --git a/backend/yandex/yandex.go b/backend/yandex/yandex.go
index d767fd176..e2b7da877 100644
--- a/backend/yandex/yandex.go
+++ b/backend/yandex/yandex.go
@@ -1158,14 +1158,16 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op
return err
}
- //if file uploaded successfully then return metadata
- o.modTime = modTime
- o.md5sum = "" // according to unit tests after put the md5 is empty.
- o.size = int64(in1.BytesRead()) // better solution o.readMetaData() ?
- //and set modTime of uploaded file
+ //set modTime of uploaded file
err = o.SetModTime(ctx, modTime)
+ if err != nil {
+ return err
+ }
- return err
+ // Re-read the metadata so the object has the md5sum the server
+ // computed for the upload.
+ o.hasMetaData = false
+ return o.readMetaData(ctx)
}
// Remove an object