mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 16:30:15 +00:00
Add package registry quota limits (#21584)
Related #20471 This PR adds global quota limits for the package registry. Settings for individual users/orgs can be added in a seperate PR using the settings table. Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
cb83288530
commit
20674dd05d
20 changed files with 378 additions and 61 deletions
|
@ -193,19 +193,23 @@ func UploadPackageFile(ctx *context.Context) {
|
|||
PackageFileInfo: packages_service.PackageFileInfo{
|
||||
Filename: strings.ToLower(boxProvider),
|
||||
},
|
||||
Data: buf,
|
||||
IsLead: true,
|
||||
Creator: ctx.Doer,
|
||||
Data: buf,
|
||||
IsLead: true,
|
||||
Properties: map[string]string{
|
||||
vagrant_module.PropertyProvider: strings.TrimSuffix(boxProvider, ".box"),
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
if err == packages_model.ErrDuplicatePackageFile {
|
||||
switch err {
|
||||
case packages_model.ErrDuplicatePackageFile:
|
||||
apiError(ctx, http.StatusConflict, 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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue