mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Fix "redirect link" handling (#33440)
`a%2fb` should not redirect to `a/b` --------- Co-authored-by: delvh <dev.lh@web.de>
This commit is contained in:
@@ -1583,13 +1583,7 @@ func registerRoutes(m *web.Router) {
|
||||
m.Get("/commit/*", context.RepoRefByType(git.RefTypeCommit), repo.Home)
|
||||
m.Get("/*", context.RepoRefByType(""), repo.Home) // "/*" route is deprecated, and kept for backward compatibility
|
||||
}, repo.SetEditorconfigIfExists)
|
||||
|
||||
// Add a /tree/* path to redirect to the /src/* path, which
|
||||
// will redirect to the canonical URL for that ref. This is
|
||||
// included so that Gitea's repo URL structure matches what
|
||||
// other forges provide, allowing clients to construct URLs
|
||||
// that work across forges.
|
||||
m.Get("/tree/*", repo.HomeRedirect)
|
||||
m.Get("/tree/*", repo.RedirectRepoTreeToSrc) // redirect "/owner/repo/tree/*" requests to "/owner/repo/src/*"
|
||||
|
||||
m.Get("/forks", context.RepoRef(), repo.Forks)
|
||||
m.Get("/commit/{sha:([a-f0-9]{7,64})}.{ext:patch|diff}", repo.MustBeNotEmpty, repo.RawDiff)
|
||||
|
Reference in New Issue
Block a user