diff options
Diffstat (limited to 'modules/context/context.go')
-rw-r--r-- | modules/context/context.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index 6fb0a2cde3..10a84cd9b1 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -176,12 +176,9 @@ func Contexter() macaron.Handler { repoName := c.Params(":reponame") branchName := "master" - owner, err := models.GetUserByName(ownerName) - if err == nil { - repo, err := models.GetRepositoryByName(owner.ID, repoName) - if err == nil && len(repo.DefaultBranch) > 0 { - branchName = repo.DefaultBranch - } + repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName) + if err == nil && len(repo.DefaultBranch) > 0 { + branchName = repo.DefaultBranch } prefix := setting.AppURL + path.Join(ownerName, repoName, "src", "branch", branchName) c.PlainText(http.StatusOK, []byte(com.Expand(` |