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.
This commit is contained in:
Nick Craig-Wood
2026-07-14 14:13:49 +01:00
parent 0efafc5210
commit 57b1f24566
+9 -8
View File
@@ -1050,14 +1050,15 @@ func (o *Object) netStorageUploadRequest(ctx context.Context, in io.Reader, src
// Invalidate stat cache // Invalidate stat cache
o.fs.deleteStatCache(URL) o.fs.deleteStatCache(URL)
if o.size == -1 { // Stat the uploaded file to get the md5 the server computed and
files, err := o.fs.netStorageStatRequest(ctx, URL, false) // the size for streaming uploads.
if err != nil { files, err := o.fs.netStorageStatRequest(ctx, URL, false)
return nil if err != nil {
} return nil
if files != nil { }
o.size = files[0].Size if files != nil {
} o.size = files[0].Size
o.md5sum = files[0].Md5
} }
return nil return nil
} }