-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uploading zero-byte stream, with length -1 fails #270
Comments
@LordMike Thanks for filing this issue. We will take a look and get back to you. |
@LordMike,when you specify length as -1, we internally use s3 multipart API since the stream size is unknown. However s3 multipart API does not allow 0 byte uploads, hence the MalformedXML error that you are seeing. At the SDK level, we cannot fix this - your application needs to figure out the stream size or handle the error if -1 is passed as size for PutObjectAsync API on a zero byte stream |
Thanks for being quick. Can we do a multipart upload ourselves using the Minio SDK? -- else the only option we have seems to be handling this error... Or reading the first byte, if it didn't exist, then it was a 0 byte stream, and we can do a put using that size, and if it did exist, we create a new stream that wraps the first byte and then reads from the original stream again.. |
@LordMike, the SDK does not provide multipart upload operation as an API call - however you could use the second approach to read the first byte and determine whether to call PutObjectAsync with 0 as size for a zero byte stream, or create a new stream that wraps first byte with original stream and pass it to PutObjectAsync with -1 as size. |
Would it be possible for the Minio SDK to get this feature? .. I imagine others would need this as well. |
@poornas if we see an EOF early with -1 then we can upload just the zero bytes with single part which is allowed in multipart uploads. |
@harshavardhana, yes we could do that. |
We have a piece of code that doesn't know how long the input stream is (compressed data), so we pass
-1
to MiniosPutObjectAsync
. This fails with the below exceptionMinio API responded with message=The XML you provided was not well-formed or did not validate against our published schema.
I've been sending in zero-length
MemoryStream
s and can confirm that if I send in a one-byteMemoryStream
, the issue disappears.The text was updated successfully, but these errors were encountered: