aboutsummaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-11-04 19:26:38 +0200
committerGitHub <noreply@github.com>2017-11-04 19:26:38 +0200
commit57de1ff991a864c8adf669e3919247c555e7a75a (patch)
treea0eee0dd01ff934a491743fa9d748d29ceb5bfbd /modules/context/repo.go
parent76b8c3c68fb49a2ac779f30f1de105c73c691825 (diff)
downloadgitea-57de1ff991a864c8adf669e3919247c555e7a75a.tar.gz
gitea-57de1ff991a864c8adf669e3919247c555e7a75a.zip
Fix API raw file content access for default branch (#2849)
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 850b127e59..c61010ecba 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -507,7 +507,11 @@ func getRefName(ctx *Context, pathType RepoRefType) string {
if refName := getRefName(ctx, RepoRefTag); len(refName) > 0 {
return refName
}
- return getRefName(ctx, RepoRefCommit)
+ if refName := getRefName(ctx, RepoRefCommit); len(refName) > 0 {
+ return refName
+ }
+ ctx.Repo.TreePath = path
+ return ctx.Repo.Repository.DefaultBranch
case RepoRefBranch:
return getRefNameFromPath(ctx, path, ctx.Repo.GitRepo.IsBranchExist)
case RepoRefTag: