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 henrygoodman committed Jan 31, 2024
1 parent 1019f57 commit 4a14230
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 4a14230

Please sign in to comment.