summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2022-01-25 08:33:40 +0200
committerGitHub <noreply@github.com>2022-01-25 08:33:40 +0200
commit6392f4691af7db20a2ad81ec19408fa9377a5cd1 (patch)
tree0553b384cdde77323b40f8d70daa38ba8d4a5280 /routers
parent9628a76ce6f4fea8508f79747d78007907e3ea76 (diff)
downloadgitea-6392f4691af7db20a2ad81ec19408fa9377a5cd1.tar.gz
gitea-6392f4691af7db20a2ad81ec19408fa9377a5cd1.zip
API: Return primary language and repository language stats API URL (#18396)
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/repo.go5
-rw-r--r--routers/api/v1/user/repo.go5
2 files changed, 10 insertions, 0 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index c2dfc4f193..7a7fe218e8 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -533,6 +533,11 @@ func Get(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/Repository"
+ if err := ctx.Repo.Repository.LoadAttributes(ctx); err != nil {
+ ctx.Error(http.StatusInternalServerError, "Repository.LoadAttributes", err)
+ return
+ }
+
ctx.JSON(http.StatusOK, convert.ToRepo(ctx.Repo.Repository, ctx.Repo.AccessMode))
}
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index 3d5c841856..109548ec76 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -32,6 +32,11 @@ func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) {
return
}
+ if err := repos.LoadAttributes(); err != nil {
+ ctx.Error(http.StatusInternalServerError, "RepositoryList.LoadAttributes", err)
+ return
+ }
+
apiRepos := make([]*api.Repository, 0, len(repos))
for i := range repos {
access, err := models.AccessLevel(ctx.User, repos[i])