mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-08 07:49:50 +02:00
fix broken hooks
This commit is contained in:
1 parent
ae8a64cd74
commit
37768f16aa
53 files changed
+270
-175
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -387,6 +388,8 @@ func EarlyResponseForGoGetMeta(ctx *Context) {
|
||||
ctx.PlainText(http.StatusOK, htmlMeta)
|
||||
}
|
||||
|
||||
var pathRegex = regexp.MustCompile(`(?i).*/[a-z\-0-9_]+/(\d+/)?[a-z\-0-9_]`)
|
||||
|
||||
// RedirectToRepo redirect to a differently-named repository
|
||||
func RedirectToRepo(ctx *Base, redirectRepoID int64) {
|
||||
ownerName := ctx.PathParam("username")
|
||||
@@ -398,6 +401,8 @@ func RedirectToRepo(ctx *Base, redirectRepoID int64) {
|
||||
ctx.HTTPError(http.StatusInternalServerError, "GetRepositoryByID")
|
||||
return
|
||||
}
|
||||
pathRegex.ReplaceAllString(ctx.Req.URL.EscapedPath(),
|
||||
url.PathEscape(repo.OwnerName)+"/$1"+url.PathEscape(repo.Name))
|
||||
|
||||
redirectPath := strings.Replace(
|
||||
ctx.Req.URL.EscapedPath(),
|
||||
@@ -542,7 +547,7 @@ func RepoAssignment(ctx *Context) {
|
||||
}
|
||||
|
||||
// Get repository.
|
||||
repo, err := repo_model.GetRepositoryByName(ctx, ctx.Repo.Owner.ID, repoName)
|
||||
repo, err := repo_model.GetRepositoryByName(ctx, ctx.Repo.Owner.ID, gid, repoName)
|
||||
if err != nil {
|
||||
if repo_model.IsErrRepoNotExist(err) {
|
||||
redirectRepoID, err := repo_model.LookupRedirect(ctx, ctx.Repo.Owner.ID, repoName)
|
||||
|
||||
Reference in new issue
Block a user