mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-19 11:54:56 +02:00
fix repo api url
This commit is contained in:
parent
1e4b87c21d
commit
bc48d5dea7
@ -389,7 +389,11 @@ func (repo *Repository) CommitLink(commitID string) (result string) {
|
|||||||
// APIURL returns the repository API URL
|
// APIURL returns the repository API URL
|
||||||
func (repo *Repository) APIURL(ctxOpt ...context.Context) string {
|
func (repo *Repository) APIURL(ctxOpt ...context.Context) string {
|
||||||
ctx := util.OptionalArg(ctxOpt, context.TODO())
|
ctx := util.OptionalArg(ctxOpt, context.TODO())
|
||||||
return httplib.MakeAbsoluteURL(ctx, setting.AppSubURL+"/api/v1/repos/"+url.PathEscape(repo.OwnerName)+"/"+url.PathEscape(repo.Name))
|
var groupSegment string
|
||||||
|
if repo.GroupID > 0 {
|
||||||
|
groupSegment = fmt.Sprintf("group/%d", repo.GroupID)
|
||||||
|
}
|
||||||
|
return httplib.MakeAbsoluteURL(ctx, setting.AppSubURL+"/api/v1/repos/"+url.PathEscape(repo.OwnerName)+"/"+groupSegment+url.PathEscape(repo.Name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommitsCountCacheKey returns cache key used for commits count caching.
|
// GetCommitsCountCacheKey returns cache key used for commits count caching.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user