mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Fix incorrect CORS failure detection logic (#23844)
Regression of #23495 Fixes #23838 Fixes #23850
This commit is contained in:
		@@ -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):]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user