Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

fix(upload): keep Content-MD5 on 204 unchanged writes (#9198)

steve.wei1a7ab2ea82c7
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go
index 722bd352a3..1312911ba4 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 418f3c2356..3477a411f9 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
}