mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-03 09:52:26 +02:00
Return 400 but not 500 when request archive with wrong format (#17691)
This commit is contained in:
parent
d8a8961b99
commit
81a4fc7528
4 changed files with 80 additions and 9 deletions
|
@ -373,7 +373,11 @@ func Download(ctx *context.Context) {
|
|||
uri := ctx.Params("*")
|
||||
aReq, err := archiver_service.NewRequest(ctx.Repo.Repository.ID, ctx.Repo.GitRepo, uri)
|
||||
if err != nil {
|
||||
ctx.ServerError("archiver_service.NewRequest", err)
|
||||
if errors.Is(err, archiver_service.ErrUnknownArchiveFormat{}) {
|
||||
ctx.Error(http.StatusBadRequest, err.Error())
|
||||
} else {
|
||||
ctx.ServerError("archiver_service.NewRequest", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if aReq == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue