minio-dotnet icon indicating copy to clipboard operation
minio-dotnet copied to clipboard

GetObjectAsync / WithOffsetAndLength returns error text from server instead of throwing exception

Open sebbarg opened this issue 7 months ago • 0 comments

GetObjectAsync / WithOffsetAndLength with an out-of-range offset and/or offset+length > long.MaxValue returns an XML formatted error text in the stream instead of throwing an error.

Tested on Hetzner S3 Object Storage.

var offset = 123; // larger than size of the requested object
var length = long.MaxValue;
var getArgs = new GetObjectArgs()
    .WithBucket(BucketName)
    .WithObject(path)
    .WithOffsetAndLength(offset, length)
    .WithCallbackStream(async (stream, ct) =>
    {
        await stream.CopyToAsync(memoryStream, ct);
    });

await _minioClient.GetObjectAsync(getArgs, cancellationToken); 

It should probably throw an exception instead.

sebbarg avatar May 23 '25 08:05 sebbarg