[API] Only Return Json (#13511) (#13565)

Backport #13511 

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
6543 2020-11-15 17:29:16 +01:00 committed by GitHub
parent 9a8e02ce30
commit 48fca01b0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 103 additions and 48 deletions

View file

@ -704,7 +704,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)
@ -773,7 +772,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 {