|
4 | 4 | package repo |
5 | 5 |
|
6 | 6 | import ( |
7 | | - "errors" |
8 | 7 | "fmt" |
9 | 8 | "net/http" |
10 | 9 |
|
11 | 10 | "code.gitea.io/gitea/models/db" |
12 | 11 | git_model "code.gitea.io/gitea/models/git" |
13 | 12 | api "code.gitea.io/gitea/modules/structs" |
14 | | - "code.gitea.io/gitea/modules/util" |
15 | 13 | "code.gitea.io/gitea/modules/web" |
16 | 14 | "code.gitea.io/gitea/routers/api/v1/utils" |
17 | 15 | "code.gitea.io/gitea/services/context" |
@@ -179,13 +177,8 @@ func GetCommitStatusesByRef(ctx *context.APIContext) { |
179 | 177 | // "404": |
180 | 178 | // "$ref": "#/responses/notFound" |
181 | 179 |
|
182 | | - refCommit, err := utils.ResolveRefCommit(ctx, ctx.PathParam("ref")) |
183 | | - if err != nil { |
184 | | - if errors.Is(err, util.ErrNotExist) { |
185 | | - ctx.APIErrorNotFound(err) |
186 | | - } else { |
187 | | - ctx.APIErrorInternal(err) |
188 | | - } |
| 180 | + refCommit := resolveRefCommit(ctx, ctx.PathParam("ref")) |
| 181 | + if ctx.Written() { |
189 | 182 | return |
190 | 183 | } |
191 | 184 | getCommitStatuses(ctx, refCommit.CommitID) |
@@ -258,13 +251,8 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) { |
258 | 251 | // "404": |
259 | 252 | // "$ref": "#/responses/notFound" |
260 | 253 |
|
261 | | - refCommit, err := utils.ResolveRefCommit(ctx, ctx.PathParam("ref")) |
262 | | - if err != nil { |
263 | | - if errors.Is(err, util.ErrNotExist) { |
264 | | - ctx.APIErrorNotFound(err) |
265 | | - } else { |
266 | | - ctx.APIErrorInternal(err) |
267 | | - } |
| 254 | + refCommit := resolveRefCommit(ctx, ctx.PathParam("ref")) |
| 255 | + if ctx.Written() { |
268 | 256 | return |
269 | 257 | } |
270 | 258 |
|
|
0 commit comments