From 0efafc5210e09eb267f9d51ba23a7f26f0b09056 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 14 Jul 2026 12:25:36 +0100 Subject: [PATCH] yandex: fix missing MD5 hash after uploading a file Update (which Put also uses) cleared the object's MD5 checksum after upload, so until the object was re-read it had no hash while a fresh listing would report the MD5 the server computed. This broke wrappers which compare exact hashes, such as the hasher backend's fingerprint and the VFS cache. Re-read the object's metadata after upload to pick up the server computed MD5 (and authoritative size). --- backend/yandex/yandex.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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