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.