From 3e190326564f32c5bee1e4c21185f5cc36a61142 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 14 Jul 2026 12:25:36 +0100 Subject: [PATCH] filescom: fix missing MD5 hash after uploading a file The server computes the MD5 checksum asynchronously after upload, so the object returned from Put and Update often had no MD5 while a fresh listing shortly afterwards would report one. This broke wrappers which compare exact hashes, such as the hasher backend's fingerprint and the VFS cache. Retry reading the metadata for a short time after upload until the MD5 appears. --- backend/filescom/filescom.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/backend/filescom/filescom.go b/backend/filescom/filescom.go index 38807d03a..62d0f432d 100644 --- a/backend/filescom/filescom.go +++ b/backend/filescom/filescom.go @@ -866,7 +866,24 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, op return err } - return o.readMetaData(ctx) + // The server computes the MD5 asynchronously after upload so + // retry reading the metadata for a short time until it appears. + const maxTries = 10 + for tries := 1; ; tries++ { + err = o.readMetaData(ctx) + if err != nil { + return err + } + if o.md5 != "" || tries >= maxTries { + break + } + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(time.Duration(tries) * 100 * time.Millisecond): + } + } + return nil } // Remove an object