minio/minio-dotnet

Crash when uploading a zip archive

megasuperlexa opened this issue · 2 comments

My code:

 var putObjectArgs = new PutObjectArgs()
                .WithBucket(bucketName)
                .WithObject(objectName)
                .WithStreamData(source)
                .WithObjectSize(dataLength)
                .WithContentType(contentType);

            var result = await _client.PutObjectAsync(putObjectArgs, cancellationToken);

the error:

Error during report "6628ac4ae032245e3c537bb7" generation: "System.InvalidOperationException: There is an error in XML document (1, 2).
 ---> System.InvalidOperationException: <html xmlns='http://s3.amazonaws.com/doc/2006-03-01/'> was not expected.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderInitiateMultipartUploadResult.Read3_InitiateMultipartUploadResult()
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
   at Minio.Helper.Utils.DeserializeXml[T](Stream stream)
   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)

I checked NewMultipartUploadResponse in minio-dotnet code and it seems to contain the needed namespace attribute.

minio-dotnet version: 6.0.2
dotnet 8

You are receiving an HTTP response -- or something that looks like XML that has been mangled into HTML.

So it looks like something is intercepting and mangling the response.

The response should look like this:

<InitiateMultipartUploadResult
            xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
...

... not <html xmlns='http://s3.am....

after Admin intervention, everything is fine. They dont tell me what was wrong but clearly not a bug in the library.