Skip to content

Commit

Permalink
Also match weakly validated ETags (go-gitea#28957)
Browse files Browse the repository at this point in the history
  • Loading branch information
2 people authored and silverwind committed Feb 20, 2024
1 parent 4c15ab7 commit 877f9a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/httpcache/httpcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func checkIfNoneMatchIsValid(req *http.Request, etag string) bool {
ifNoneMatch := req.Header.Get("If-None-Match")
if len(ifNoneMatch) > 0 {
for _, item := range strings.Split(ifNoneMatch, ",") {
item = strings.TrimSpace(item)
item = strings.TrimPrefix(strings.TrimSpace(item), "W/") // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#directives
if item == etag {
return true
}
Expand Down

0 comments on commit 877f9a4

Please sign in to comment.