Skip to content

Commit

Permalink
PutObjectAsync with Snowball header must not use multipart
Browse files Browse the repository at this point in the history
PutObjectAsync must not use multipart if has header "X-Amz-Meta-Snowball-Auto-Extract=true"
See minio/minio#17033
  • Loading branch information
emrocha authored and ebozduman committed Jun 14, 2023
1 parent 5e82e86 commit 6528d9b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Minio/ApiEndpoints/ObjectOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,12 @@ public async Task<PutObjectResponse> PutObjectAsync(PutObjectArgs args,
args?.Validate();
args.SSE?.Marshal(args.Headers);

// Upload object in single part if size falls under restricted part size.
if (args.ObjectSize < Constants.MinimumPartSize && args.ObjectSize >= 0 && args.ObjectStreamData is not null)
var isSnowball = args.Headers.ContainsKey("X-Amz-Meta-Snowball-Auto-Extract") &&
Convert.ToBoolean(args.Headers["X-Amz-Meta-Snowball-Auto-Extract"]);

// Upload object in single part if size falls under restricted part size
// or the request has snowball objects
if ((args.ObjectSize < Constants.MinimumPartSize || isSnowball) && args.ObjectSize >= 0 && args.ObjectStreamData is not null)
{
var bytes = await ReadFullAsync(args.ObjectStreamData, (int)args.ObjectSize).ConfigureAwait(false);
var bytesRead = bytes.Length;
Expand Down Expand Up @@ -1395,4 +1399,4 @@ private async Task MultipartCopyUploadAsync(string bucketName, string objectName
await CompleteMultipartUploadAsync(destBucketName, destObjectName,
uploadId, etags, cancellationToken).ConfigureAwait(false);
}
}
}

0 comments on commit 6528d9b

Please sign in to comment.