diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-03-31 23:35:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 11:35:48 -0400 |
commit | 78046e5137dfbcbe0398a33ae9fd48d7edb2912d (patch) | |
tree | a9f2147029fa566e9df8bf0311a27cb6350ed070 /modules/public | |
parent | 6e58f8400e911e642957acb6d4b63111d98d3de7 (diff) | |
download | gitea-78046e5137dfbcbe0398a33ae9fd48d7edb2912d.tar.gz gitea-78046e5137dfbcbe0398a33ae9fd48d7edb2912d.zip |
Fix incorrect CORS failure detection logic (#23844)
Regression of #23495
Fixes #23838
Fixes #23850
Diffstat (limited to 'modules/public')
-rw-r--r-- | modules/public/public.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/public/public.go b/modules/public/public.go index 30b03a2795..2c96cf9e76 100644 --- a/modules/public/public.go +++ b/modules/public/public.go @@ -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):] |