From bda34fe16a06a5dffeb80e845e2bf811d9165ac8 Mon Sep 17 00:00:00 2001 From: Janos Guljas Date: Wed, 13 Jun 2018 18:21:03 +0200 Subject: [PATCH] swarm/api/http: set ETag header with correct syntax --- swarm/api/http/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swarm/api/http/server.go b/swarm/api/http/server.go index 1fa2f72fa2..ba8b2b7ba9 100644 --- a/swarm/api/http/server.go +++ b/swarm/api/http/server.go @@ -683,7 +683,7 @@ func (s *Server) HandleGet(w http.ResponseWriter, r *Request) { } etag := common.Bytes2Hex(addr) noneMatchEtag := r.Header.Get("If-None-Match") - w.Header().Set("ETag", etag) // set etag to manifest key or raw entry key. + w.Header().Set("ETag", fmt.Sprintf("%q", etag)) // set etag to manifest key or raw entry key. if noneMatchEtag != "" { if bytes.Equal(storage.Address(common.Hex2Bytes(noneMatchEtag)), addr) { Respond(w, r, "Not Modified", http.StatusNotModified) @@ -931,7 +931,7 @@ func (s *Server) HandleGetFile(w http.ResponseWriter, r *Request) { etag := common.Bytes2Hex(contentKey) noneMatchEtag := r.Header.Get("If-None-Match") - w.Header().Set("ETag", etag) // set etag to actual content key. + w.Header().Set("ETag", fmt.Sprintf("%q", etag)) // set etag to actual content key. if noneMatchEtag != "" { if bytes.Equal(storage.Address(common.Hex2Bytes(noneMatchEtag)), contentKey) { Respond(w, r, "Not Modified", http.StatusNotModified)