Skip to content

Commit

Permalink
Fix incorrect CORS failure detection logic (#23844)
Browse files Browse the repository at this point in the history
Regression of #23495

Fixes #23838
Fixes #23850
  • Loading branch information
wxiaoguang authored Mar 31, 2023
1 parent 6e58f84 commit 78046e5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/public/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ 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
// If CORS is not sent, the response must have been written by other handlers
if !corsSent {
return
}
}

file := req.URL.Path[len(opts.Prefix):]
Expand Down

0 comments on commit 78046e5

Please sign in to comment.