minio/minio-dotnet

NullReferenceException If WithSSL(...) is omitted

warappa opened this issue · 1 comments

If one doesn't call WithSSL(...), then a NullReferenceException is triggered inside the MinIO library.

Steps To Reproduce

Given this code:

var services = new ServiceCollection();
services.AddMinio(client =>
{
    client
        .WithCredentials("minioadmin", "minioadmin")
        .WithEndpoint("127.0.0.1", 9000)
        //.WithSSL(false)
       ;
});

var serviceProvider = services.BuildServiceProvider();
var client = serviceProvider.GetRequiredService<IMinioClient>();

using var stream = File.OpenRead("test-data.json");

var putArgs = new PutObjectArgs()
    .WithBucket("spot-layouter-push")
    .WithObject("TestPut.json")
    .WithStreamData(stream)
    .WithObjectSize(stream.Length)
    .WithContentType("application/json");

await client.PutObjectAsync(putArgs);
  1. Have a test file greater than about 6MB
  2. Execute the code
  3. Error: NullReferenceException

Stacktrace

at Minio.DataModel.Response.NewMultipartUploadResponse..ctor(HttpStatusCode statusCode, String responseContent)
   at Minio.MinioClient.NewMultipartUploadAsync(NewMultipartUploadPutArgs args, CancellationToken cancellationToken)
   at Minio.MinioClient.PutObjectAsync(PutObjectArgs args, CancellationToken cancellationToken)

Expectations

  • Omission of calling WithSSL(...) should not cause an exception

Info

MinIO (NuGet): 6.0.2
MinIO (Server): 2024-02-06T21:36:22Z