Open minhaz109074 opened 2 months ago
Open SDK issues on relevant repos.
Would be really nice if https://github.com/minio/minio-dotnet/pull/1195 would be merged and released soon given how small of a change it is and how much of an inconvenience it can be (#1176). In our own case, we ended up losing some files sent to a S3 compatible storage due to assuming that if no exception was thrown the upload must have been successful.
It is currently, to my knowledge impossible to detect those kind of issues if you don't access the internal values using Reflection.
Here's how you can do it for the time being:
...
var putObjectResponse = await client.PutObjectAsync(args);
var putObjectResponseType = putObjectResponse.GetType();
var httpStatusCode = (System.Net.HttpStatusCode) putObjectResponseType.GetProperty(
"ResponseStatusCode",
System.Reflection.BindingFlags.NonPublic |
System.Reflection.BindingFlags.Instance
)
.GetValue(putObjectResponse);
var responseContent = (string) putObjectResponseType.GetProperty(
"ResponseContent",
Reflection.BindingFlags.NonPublic |
Reflection.BindingFlags.Instance
)
.GetValue(putObjectResponse);
Description:
In the MinIO .NET SDK, I encountered an issue where the
HttpStatusCode
in thePutObjectResponse
is internal, making it inaccessible after receiving a response. However, in AWS S3's SDK, the same property is public, which allows developers to easily access the status code of the operation.Code:
Here’s an example of how the MinIO SDK currently handles the
HttpStatusCode
:Suggestion:
Please consider changing the visibility of ResponseStatusCode from internal to public to align with the behavior of AWS S3's SDK and improve usability.
Environment: