1
0
mirror of https://gitcode.com/gitea/gitea.git synced 2025-06-29 08:37:08 +08:00

Fix incorrect CORS failure detection logic ()

Regression of 

Fixes 
Fixes 
This commit is contained in:
wxiaoguang
2023-03-31 23:35:48 +08:00
committed by GitHub
parent 6e58f8400e
commit 78046e5137

@ -45,16 +45,16 @@ func AssetsHandlerFunc(opts *Options) http.HandlerFunc {
return
}
var corsSent bool
if opts.CorsHandler != nil {
var corsSent bool
opts.CorsHandler(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
corsSent = true
})).ServeHTTP(resp, req)
}
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
}
}
file := req.URL.Path[len(opts.Prefix):]