mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09: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:
		| @@ -235,16 +235,20 @@ func UploadPackage(ctx *context.Context) { | ||||
| 			PackageFileInfo: packages_service.PackageFileInfo{ | ||||
| 				Filename: strings.ToLower(fmt.Sprintf("%s.%s.zip", strings.ReplaceAll(cp.Name, "/", "-"), cp.Version)), | ||||
| 			}, | ||||
| 			Data:   buf, | ||||
| 			IsLead: true, | ||||
| 			Creator: ctx.Doer, | ||||
| 			Data:    buf, | ||||
| 			IsLead:  true, | ||||
| 		}, | ||||
| 	) | ||||
| 	if err != nil { | ||||
| 		if err == packages_model.ErrDuplicatePackageVersion { | ||||
| 		switch err { | ||||
| 		case packages_model.ErrDuplicatePackageVersion: | ||||
| 			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 | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user