Skip to content

Commit

Permalink
fix: Adding debug log for investigating etag problem
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed May 20, 2022
1 parent 8520951 commit 95f2ab6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/crud/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (a App) handleDir(w http.ResponseWriter, r *http.Request, request provider.
}

if query.GetBool(r, "thumbnail") {
a.thumbnailApp.List(w, r, item, items)
a.thumbnailApp.List(w, r, request, item, items)
return renderer.Page{}, nil
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/provider/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,7 @@ func EtagMatch(w http.ResponseWriter, r *http.Request, hash string) (etag string
match = true
}

logger.Info("Request is `%s`, Hash is `%s`, `If-None-Match` is `%s`, Match ? %t", r.URL.String(), hash, r.Header.Get("If-None-Match"), match)

return
}
4 changes: 2 additions & 2 deletions pkg/thumbnail/thumbnail.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (a App) Serve(w http.ResponseWriter, r *http.Request, item absto.Item) {
}

// List return all thumbnail in a base64 form
func (a App) List(w http.ResponseWriter, r *http.Request, item absto.Item, items []absto.Item) {
func (a App) List(w http.ResponseWriter, r *http.Request, request provider.Request, item absto.Item, items []absto.Item) {
if len(items) == 0 {
w.WriteHeader(http.StatusNoContent)
return
Expand All @@ -205,7 +205,7 @@ func (a App) List(w http.ResponseWriter, r *http.Request, item absto.Item, items
ctx := r.Context()

var hash string
if query.GetBool(r, "search") {
if query.GetBool(r, "search") || request.IsStory() {
hash = a.thumbnailHash(ctx, items)
} else if thumbnails, err := a.ListDir(ctx, item); err == nil {
hash = sha.New(thumbnails)
Expand Down

0 comments on commit 95f2ab6

Please sign in to comment.