summaryrefslogtreecommitdiffstats
path: root/routers/api/packages/npm/npm.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/npm/npm.go')
-rw-r--r--routers/api/packages/npm/npm.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/api/packages/npm/npm.go b/routers/api/packages/npm/npm.go
index 1a09cb6f36..0d25f173e9 100644
--- a/routers/api/packages/npm/npm.go
+++ b/routers/api/packages/npm/npm.go
@@ -158,7 +158,11 @@ func DownloadPackageFileByName(ctx *context.Context) {
func UploadPackage(ctx *context.Context) {
npmPackage, err := npm_module.ParsePackage(ctx.Req.Body)
if err != nil {
- apiError(ctx, http.StatusBadRequest, err)
+ if errors.Is(err, util.ErrInvalidArgument) {
+ apiError(ctx, http.StatusBadRequest, err)
+ } else {
+ apiError(ctx, http.StatusInternalServerError, err)
+ }
return
}