-
Notifications
You must be signed in to change notification settings - Fork 862
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
Error response is not parsed if Content-Type header also contains character set #3009
Comments
@DetlefGolze Thanks for opening the issue. Could you please share the sample code to reproduce the issue where an S3 store returns using (AmazonS3Client amazonS3Client = new AmazonS3Client(RegionEndpoint.USEast2))
{
string objectName = "nosuchkey.txt";
var request = new GetObjectAttributesRequest
{
BucketName = bucketName,
Key = objectName,
ObjectAttributes = new List<ObjectAttributes> { ObjectAttributes.ObjectSize }
};
GetObjectAttributesResponse response = await amazonS3Client.GetObjectAttributesAsync(request);
Console.WriteLine(response.ObjectSize);
Console.WriteLine(response.LastModified.ToString());
} I understand the use case, however, it would be good to have a reproduction for further review with the team. Thanks, |
@ashishdhingra Thanks for your effort and sorry for the confusion. I don't think that you can duplicate this behaviour with arbitrary S3 servers and especially not with AWS. I've seen this with another vendor's S3 server and as far as I can tell, it returns this header with any XML response. I found this when using AmazonS3Util.DoesS3BucketExistV2Async() which relies on the S3 error code and unexpectedly throws due to the mentioned issue. Your code above would also show that issue. I am not sure if I am allowed to post the name of the vendor here, but it is well known in the market. We will also inform them about this issue, but obviously it is not really a bug in their implementation. |
I was able to produce the issue using non AWS cloud vendor which has S3-compatabile object storage. |
@DetlefGolze I saw you submitted PR #3011 for the fix. Could you please confirm if it works for your use case with non-AWS S3 (like) service? |
Yes, of course it fixes the issue with the non-AWS store and still works with AWS. I tested both and even with a 3rd system.
|
The PR #3011 was released today in AWSSDK.S3 3.7.202 via commit deff03f. |
|
Describe the bug
An S3 store returns the following header in error responses:
Content-Type: application/xml;charset=utf-8
In this case the S3ErrorResponseUnmarshaller does not parse the XML body so that the produced exception does not contain full error information. Instead, the exception is filled only with data from the HTTP status, e.g.:
Expected Behavior
Exception shall contain information from error response.
Current Behavior
Exception only uses HTTP status code.
Reproduction Steps
Please refer to error description above.
Possible Solution
Change line 86 in sdk\src\Services\S3\Custom\Model\Internal\MarshallTransformations\S3ErrorResponseUnmarshaller.cs
from
to
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.S3 version 3.7.201.2
Targeted .NET Platform
.NET 6
Operating System and version
Windows Server 2019
The text was updated successfully, but these errors were encountered: