Skip to content

Commit

Permalink
Don't close cached publication
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolatkey committed May 29, 2024
1 parent 7f71e92 commit 90e2084
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions cmd/rwp/cmd/serve/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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"])
Expand Down

0 comments on commit 90e2084

Please sign in to comment.