summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-09-16 00:42:19 +0200
committerGitHub <noreply@github.com>2020-09-15 18:42:19 -0400
commit07995e23018b5aa3906884f3c80ea5181250121e (patch)
treec45ef886e0b462ece7620b9545de4fd64becc230 /routers
parent772b5e0f548548d5633b99fb40f59e5075f1c6db (diff)
downloadgitea-07995e23018b5aa3906884f3c80ea5181250121e.tar.gz
gitea-07995e23018b5aa3906884f3c80ea5181250121e.zip
Fix [API] [Bug] CreateRepo missing information (#12848)
* Fix [API] [Bug] CreateRepo missing information * add code comment Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/repo.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index 35062500f7..603187c16d 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -257,6 +257,12 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
return
}
+ // reload repo from db to get a real state after creation
+ repo, err = models.GetRepositoryByID(repo.ID)
+ if err != nil {
+ ctx.Error(http.StatusInternalServerError, "GetRepositoryByID", err)
+ }
+
ctx.JSON(http.StatusCreated, repo.APIFormat(models.AccessModeOwner))
}