From 90e20848b87600f1f5e98fda2abc9e28eb1bb3e9 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 29 May 2024 16:15:34 -0700 Subject: [PATCH] Don't close cached publication --- cmd/rwp/cmd/serve/api.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/rwp/cmd/serve/api.go b/cmd/rwp/cmd/serve/api.go index 82db26ba..552b6fbc 100644 --- a/cmd/rwp/cmd/serve/api.go +++ b/cmd/rwp/cmd/serve/api.go @@ -110,7 +110,6 @@ func (s *Server) getManifest(w http.ResponseWriter, req *http.Request) { w.WriteHeader(500) return } - defer publication.Close() // Create "self" link in manifest scheme := "http://" @@ -158,7 +157,7 @@ func (s *Server) getManifest(w http.ResponseWriter, req *http.Request) { w.Header().Set("access-control-allow-origin", "*") // TODO: provide options? // Etag based on hash of the manifest bytes - etag := strconv.FormatUint(xxh3.Hash(identJSON.Bytes()), 36) + etag := `"` + strconv.FormatUint(xxh3.Hash(identJSON.Bytes()), 36) + `"` w.Header().Set("Etag", etag) if match := req.Header.Get("If-None-Match"); match != "" { if strings.Contains(match, etag) { @@ -187,7 +186,6 @@ func (s *Server) getAsset(w http.ResponseWriter, r *http.Request) { w.WriteHeader(500) return } - defer publication.Close() // Make sure the asset exists in the publication href := path.Clean(vars["asset"])