diff options
Diffstat (limited to 'routers/api/packages/rubygems/rubygems.go')
-rw-r--r-- | routers/api/packages/rubygems/rubygems.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/routers/api/packages/rubygems/rubygems.go b/routers/api/packages/rubygems/rubygems.go index c1a10b5e78..af358fb82f 100644 --- a/routers/api/packages/rubygems/rubygems.go +++ b/routers/api/packages/rubygems/rubygems.go @@ -6,6 +6,7 @@ package rubygems import ( "compress/gzip" "compress/zlib" + "errors" "fmt" "io" "net/http" @@ -217,7 +218,11 @@ func UploadPackageFile(ctx *context.Context) { rp, err := rubygems_module.ParsePackageMetaData(buf) if err != nil { - apiError(ctx, http.StatusInternalServerError, err) + if errors.Is(err, util.ErrInvalidArgument) { + apiError(ctx, http.StatusBadRequest, err) + } else { + apiError(ctx, http.StatusInternalServerError, err) + } return } if _, err := buf.Seek(0, io.SeekStart); err != nil { |