|
|
@ -43,6 +43,11 @@ func GetRawFile(ctx *context.APIContext) { |
|
|
|
// description: filepath of the file to get
|
|
|
|
// description: filepath of the file to get
|
|
|
|
// type: string
|
|
|
|
// type: string
|
|
|
|
// required: true
|
|
|
|
// required: true
|
|
|
|
|
|
|
|
// - name: ref
|
|
|
|
|
|
|
|
// in: query
|
|
|
|
|
|
|
|
// description: "The name of the commit/branch/tag. Default the repository’s default branch (usually master)"
|
|
|
|
|
|
|
|
// type: string
|
|
|
|
|
|
|
|
// required: false
|
|
|
|
// responses:
|
|
|
|
// responses:
|
|
|
|
// 200:
|
|
|
|
// 200:
|
|
|
|
// description: success
|
|
|
|
// description: success
|
|
|
@ -54,7 +59,22 @@ func GetRawFile(ctx *context.APIContext) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
blob, err := ctx.Repo.Commit.GetBlobByPath(ctx.Repo.TreePath) |
|
|
|
commit := ctx.Repo.Commit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ref := ctx.QueryTrim("ref"); len(ref) > 0 { |
|
|
|
|
|
|
|
var err error |
|
|
|
|
|
|
|
commit, err = ctx.Repo.GitRepo.GetCommit(ref) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
if git.IsErrNotExist(err) { |
|
|
|
|
|
|
|
ctx.NotFound() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
ctx.Error(http.StatusInternalServerError, "GetBlobByPath", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
blob, err := commit.GetBlobByPath(ctx.Repo.TreePath) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if git.IsErrNotExist(err) { |
|
|
|
if git.IsErrNotExist(err) { |
|
|
|
ctx.NotFound() |
|
|
|
ctx.NotFound() |
|
|
|