File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ package routers
55
66import  (
77	"context" 
8+ 	"net/http" 
89	"reflect" 
910	"runtime" 
1011
@@ -25,6 +26,7 @@ import (
2526	"code.gitea.io/gitea/modules/templates" 
2627	"code.gitea.io/gitea/modules/translation" 
2728	"code.gitea.io/gitea/modules/web" 
29+ 	"code.gitea.io/gitea/modules/web/routing" 
2830	actions_router "code.gitea.io/gitea/routers/api/actions" 
2931	packages_router "code.gitea.io/gitea/routers/api/packages" 
3032	apiv1 "code.gitea.io/gitea/routers/api/v1" 
@@ -202,5 +204,9 @@ func NormalRoutes() *web.Route {
202204		r .Mount (prefix , actions_router .ArtifactsV4Routes (prefix ))
203205	}
204206
207+ 	r .NotFound (func (w  http.ResponseWriter , req  * http.Request ) {
208+ 		routing .UpdateFuncInfo (req .Context (), routing .GetFuncInfo (http .NotFound , "GlobalNotFound" ))
209+ 		http .NotFound (w , req )
210+ 	})
205211	return  r 
206212}
Original file line number Diff line number Diff line change @@ -1612,7 +1612,7 @@ func registerRoutes(m *web.Route) {
16121612
16131613	m .NotFound (func (w  http.ResponseWriter , req  * http.Request ) {
16141614		ctx  :=  context .GetWebContext (req )
1615- 		routing .UpdateFuncInfo (ctx , routing .GetFuncInfo (ctx .NotFound , "GlobalNotFound " ))
1615+ 		routing .UpdateFuncInfo (ctx , routing .GetFuncInfo (ctx .NotFound , "WebNotFound " ))
16161616		ctx .NotFound ("" , nil )
16171617	})
16181618}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments