fix broken hooks

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ committed 2026-04-02 20:00:58 -04:00
1 parent ae8a64cd74
commit 37768f16aa
53 files changed
+270 -175

No files matched your search

+6 -1
View File
@@ -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)