summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-11-14 17:13:55 +0100
committerGitHub <noreply@github.com>2020-11-14 11:13:55 -0500
commit7d2700c8be5da8f2073a576dae209ae07ac6ed22 (patch)
tree072698eb27e6b8a1e1da3aa0313283d89127598a /modules/context/repo.go
parent3f3447a1ea8ed0d89ed862b7da506c97030d670e (diff)
downloadgitea-7d2700c8be5da8f2073a576dae209ae07ac6ed22.tar.gz
gitea-7d2700c8be5da8f2073a576dae209ae07ac6ed22.zip
[API] Only Return Json (#13511)
* Let Branch and Raw Endpoint return json error if not found * Revert "RM RepoRefByTypeForAPI and move needed parts into GetRawFile directly" This reverts commit d826d08577b23765cb3c257e7a861191d1aa9a04. * more similar to RepoRefByType * dedub-code * API should just speak JSON * nice name Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 0ef644b522..8a2b99c854 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -716,7 +716,6 @@ func RepoRefByType(refType RepoRefType) macaron.Handler {
err error
)
- // For API calls.
if ctx.Repo.GitRepo == nil {
repoPath := models.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)
ctx.Repo.GitRepo, err = git.OpenRepository(repoPath)
@@ -785,7 +784,7 @@ func RepoRefByType(refType RepoRefType) macaron.Handler {
ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetCommit(refName)
if err != nil {
- ctx.NotFound("GetCommit", nil)
+ ctx.NotFound("GetCommit", err)
return
}
} else {