Skip to content

Commit

Permalink
fix: enforce bucket quota from browser uploads (#10129)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana committed Jul 25, 2020
1 parent 8a23988 commit 5ffc733
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/web-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5ffc733

Please sign in to comment.