mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
fix: enforce bucket quota from browser uploads (#10129)
This commit is contained in:
parent
8a23988711
commit
5ffc733eec
@ -1037,6 +1037,11 @@ func (web *webAPIHandlers) Upload(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if err := enforceBucketQuota(ctx, bucket, size); err != nil {
|
||||
writeWebErrorResponse(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
// Extract incoming metadata if any.
|
||||
metadata, err := extractMetadata(ctx, r)
|
||||
if err != nil {
|
||||
@ -2201,6 +2206,8 @@ func toWebAPIError(ctx context.Context, err error) APIError {
|
||||
switch err.(type) {
|
||||
case StorageFull:
|
||||
return getAPIError(ErrStorageFull)
|
||||
case BucketQuotaExceeded:
|
||||
return getAPIError(ErrAdminBucketQuotaExceeded)
|
||||
case BucketNotFound:
|
||||
return getAPIError(ErrNoSuchBucket)
|
||||
case BucketNotEmpty:
|
||||
|
Loading…
Reference in New Issue
Block a user