aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/packages/pypi
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/packages/pypi')
-rw-r--r--routers/api/packages/pypi/pypi.go14
1 files changed, 9 insertions, 5 deletions
diff --git a/routers/api/packages/pypi/pypi.go b/routers/api/packages/pypi/pypi.go
index 4c8041c30c..4853e6658b 100644
--- a/routers/api/packages/pypi/pypi.go
+++ b/routers/api/packages/pypi/pypi.go
@@ -162,16 +162,20 @@ func UploadPackageFile(ctx *context.Context) {
PackageFileInfo: packages_service.PackageFileInfo{
Filename: fileHeader.Filename,
},
- Data: buf,
- IsLead: true,
+ Creator: ctx.Doer,
+ Data: buf,
+ IsLead: true,
},
)
if err != nil {
- if err == packages_model.ErrDuplicatePackageFile {
+ switch err {
+ case packages_model.ErrDuplicatePackageFile:
apiError(ctx, http.StatusBadRequest, err)
- return
+ case packages_service.ErrQuotaTotalCount, packages_service.ErrQuotaTypeSize, packages_service.ErrQuotaTotalSize:
+ apiError(ctx, http.StatusForbidden, err)
+ default:
+ apiError(ctx, http.StatusInternalServerError, err)
}
- apiError(ctx, http.StatusInternalServerError, err)
return
}