Skip to content

Commit

Permalink
temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Jan 14, 2025
1 parent 5191149 commit 625757c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
8 changes: 3 additions & 5 deletions routers/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,11 +1336,9 @@ func registerRoutes(m *web.Router) {
m.Get("/list", repo.GetTagList)
m.Get(".rss", feedEnabled, repo.TagsListFeedRSS)
m.Get(".atom", feedEnabled, repo.TagsListFeedAtom)
}, ctxDataSet("EnableFeed", setting.Other.EnableFeed),
repo.MustBeNotEmpty, context.RepoRefByType(git.RefTypeTag, context.RepoRefByTypeOptions{IgnoreNotExistErr: true}))
m.Post("/tags/delete", repo.DeleteTag, reqSignIn,
repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, context.RepoRef())
}, optSignIn, context.RepoAssignment, reqUnitCodeReader)
}, ctxDataSet("EnableFeed", setting.Other.EnableFeed))
m.Post("/tags/delete", reqSignIn, reqRepoCodeWriter, context.RepoMustNotBeArchived(), repo.DeleteTag)
}, optSignIn, context.RepoAssignment, repo.MustBeNotEmpty, reqUnitCodeReader)
// end "/{username}/{reponame}": repo tags

m.Group("/{username}/{reponame}", func() { // repo releases
Expand Down
10 changes: 1 addition & 9 deletions services/context/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,6 @@ func getRefName(ctx *Base, repo *Repository, path string, refType git.RefType) s
return ""
}

type RepoRefByTypeOptions struct {
IgnoreNotExistErr bool
}

func repoRefFullName(typ git.RefType, shortName string) git.RefName {
switch typ {
case git.RefTypeBranch:
Expand All @@ -796,8 +792,7 @@ func repoRefFullName(typ git.RefType, shortName string) git.RefName {

// RepoRefByType handles repository reference name for a specific type
// of repository reference
func RepoRefByType(detectRefType git.RefType, opts ...RepoRefByTypeOptions) func(*Context) {
opt := util.OptionalArg(opts)
func RepoRefByType(detectRefType git.RefType) func(*Context) {
return func(ctx *Context) {
var err error
refType := detectRefType
Expand Down Expand Up @@ -908,9 +903,6 @@ func RepoRefByType(detectRefType git.RefType, opts ...RepoRefByTypeOptions) func
ctx.RespHeader().Set("Link", fmt.Sprintf(`<%s>; rel="canonical"`, canonicalURL))
}
} else {
if opt.IgnoreNotExistErr {
return
}
ctx.NotFound("RepoRef invalid repo", fmt.Errorf("branch or tag not exist: %s", refShortName))
return
}
Expand Down

0 comments on commit 625757c

Please sign in to comment.