From 57b1f24566a85a89b2eb82e461efce87c6af6cac Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 14 Jul 2026 12:25:36 +0100 Subject: [PATCH] netstorage: fix missing MD5 hash after uploading a file The object returned from Put and Update had an empty MD5 checksum while a fresh listing would report the MD5 the server computed for the upload. This broke wrappers which compare exact hashes, such as the hasher backend's fingerprint and the VFS cache. Stat the file after upload to pick up the server computed MD5. --- backend/netstorage/netstorage.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/netstorage/netstorage.go b/backend/netstorage/netstorage.go index 812eb1e27..cbc029ad9 100755 --- a/backend/netstorage/netstorage.go +++ b/backend/netstorage/netstorage.go @@ -1050,14 +1050,15 @@ func (o *Object) netStorageUploadRequest(ctx context.Context, in io.Reader, src // Invalidate stat cache o.fs.deleteStatCache(URL) - if o.size == -1 { - files, err := o.fs.netStorageStatRequest(ctx, URL, false) - if err != nil { - return nil - } - if files != nil { - o.size = files[0].Size - } + // Stat the uploaded file to get the md5 the server computed and + // the size for streaming uploads. + files, err := o.fs.netStorageStatRequest(ctx, URL, false) + if err != nil { + return nil + } + if files != nil { + o.size = files[0].Size + o.md5sum = files[0].Md5 } return nil }