From 43685788ab83d9aba7c69f27939b32a4e68ae58e Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Thu, 28 Jan 2016 22:57:23 -0500 Subject: [PATCH] Don't set empty ETag values Currently, metadata.Md5 value isn't populated, yet the ETag is set to `""`, causing AWS Java SDK to fail integrity checks with GetObject api calls. --- api-headers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api-headers.go b/api-headers.go index 032158063..f1181512e 100644 --- a/api-headers.go +++ b/api-headers.go @@ -79,7 +79,9 @@ func setObjectHeaders(w http.ResponseWriter, metadata fs.ObjectMetadata, content lastModified := metadata.Created.Format(http.TimeFormat) // object related headers w.Header().Set("Content-Type", "application/octet-stream") - w.Header().Set("ETag", "\""+metadata.Md5+"\"") + if metadata.Md5 != "" { + w.Header().Set("ETag", "\""+metadata.Md5+"\"") + } w.Header().Set("Last-Modified", lastModified) // set content range