From 1a7ab2ea82c7bf1186a6aec91ddd8ff2e6cc266d Mon Sep 17 00:00:00 2001 From: "steve.wei" Date: Fri, 24 Apr 2026 01:59:59 +0800 Subject: [PATCH] fix(upload): keep Content-MD5 on 204 unchanged writes (#9198) Return Content-MD5 in the volume unchanged-write response and read it in the uploader 204 path so multipart chunk ETag metadata is preserved. --- weed/operation/upload_content.go | 1 + weed/server/volume_server_handlers_write.go | 1 + 2 files changed, 2 insertions(+) diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index 722bd352a..1312911ba 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -455,6 +455,7 @@ func (uploader *Uploader) upload_content(ctx context.Context, fillBufferFunction etag := getEtag(resp) if resp.StatusCode == http.StatusNoContent { ret.ETag = etag + ret.ContentMd5 = resp.Header.Get("Content-MD5") return &ret, nil } diff --git a/weed/server/volume_server_handlers_write.go b/weed/server/volume_server_handlers_write.go index 418f3c235..3477a411f 100644 --- a/weed/server/volume_server_handlers_write.go +++ b/weed/server/volume_server_handlers_write.go @@ -57,6 +57,7 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) { // http 204 status code does not allow body if writeError == nil && isUnchanged { SetEtag(w, reqNeedle.Etag()) + w.Header().Set("Content-MD5", contentMd5) w.WriteHeader(http.StatusNoContent) return }