mirror of https://github.com/go-gitea/gitea.git
Also match weakly validated ETags (#28957)
https://stackoverflow.com/questions/51973120/where-does-the-w-in-an-etag-appear-from https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag# --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
parent
2a50d780f9
commit
28fe3db1fb
|
@ -59,7 +59,7 @@ func checkIfNoneMatchIsValid(req *http.Request, etag string) bool {
|
||||||
ifNoneMatch := req.Header.Get("If-None-Match")
|
ifNoneMatch := req.Header.Get("If-None-Match")
|
||||||
if len(ifNoneMatch) > 0 {
|
if len(ifNoneMatch) > 0 {
|
||||||
for _, item := range strings.Split(ifNoneMatch, ",") {
|
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 {
|
if item == etag {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue