Skip to content

Commit

Permalink
PutObjectAsync with Snowball header must not use multipart (#786)
Browse files Browse the repository at this point in the history
* PutObjectAsync with Snowball header must not use multipart

PutObjectAsync must not use multipart if has header "X-Amz-Meta-Snowball-Auto-Extract=true"
See minio/minio#17033

* Lint changes

---------

Co-authored-by: Ersan <[email protected]>
  • Loading branch information
emrocha and ebozduman authored Jun 19, 2023
1 parent 5e82e86 commit db8e206
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Minio/ApiEndpoints/ObjectOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,13 @@ 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

0 comments on commit db8e206

Please sign in to comment.