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.
This commit is contained in:
steve.wei
2026-04-24 01:59:59 +08:00
committed by GitHub
parent 6e950e0e7e
commit 1a7ab2ea82
2 changed files with 2 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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
}