修复:标签为空返回空数组,以及分支查询参数
This commit is contained in:
parent
ef95802907
commit
d101c834d8
|
@ -19,7 +19,7 @@ import (
|
|||
)
|
||||
|
||||
func ListBranches(ctx *context.APIContext) {
|
||||
searchName := ctx.Params("name")
|
||||
searchName := ctx.FormString("name")
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
skip, _ := listOptions.GetStartEnd()
|
||||
branches, totalNumOfBranches, err := hat_git.GetSearchBranches(ctx, ctx.Repo.GitRepo, searchName, skip, listOptions.PageSize)
|
||||
|
|
|
@ -98,18 +98,18 @@ func TagNameSet(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if searchName == "" {
|
||||
ctx.JSON(http.StatusOK, tags)
|
||||
} else {
|
||||
var tagNameSet []string
|
||||
for _, tag := range tags {
|
||||
var tagNameSet = make([]string, 0)
|
||||
|
||||
log.Info("tag is \n", tag)
|
||||
for _, tag := range tags {
|
||||
log.Info("tag is \n", tag)
|
||||
if searchName != "" {
|
||||
if strings.Contains(tag, searchName) {
|
||||
tagNameSet = append(tagNameSet, tag)
|
||||
}
|
||||
} else {
|
||||
tagNameSet = append(tagNameSet, tag)
|
||||
}
|
||||
ctx.JSON(http.StatusOK, tagNameSet)
|
||||
}
|
||||
ctx.JSON(http.StatusOK, tagNameSet)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue