Skip to content
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

Update minio-go to forward S3 error messages, which are not in XML #496

Merged
merged 1 commit into from Nov 17, 2021

Conversation

simonswine
Copy link
Contributor

@simonswine simonswine commented Nov 15, 2021

This is a problem I encountered a couple of times with minio s3 client. It hides no XML parseable error detail.

This PR is mainly to agree on the best way to deal with this and then I would try to upstream it to the minio client.

@simonswine simonswine changed the title WIP: Forward S3 error message, which are not in XML WIP: Forward S3 error messages, which are not in XML Nov 15, 2021
@@ -98,6 +101,14 @@ const (
reportIssue = "Please report this issue at https://github.com/minio/minio-go/issues."
)

func xmlDecodeAndBody(bodyReader io.Reader, v interface{}) ([]byte, error) {
body, err := ioutil.ReadAll(bodyReader)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a limited reader here, otherwise there is danger of crashing if the far-end has included 26GB of detail.

@pracucci
Copy link
Collaborator

👍 I think it's a good idea fixing it (and yes, we have to do it in the upstream client).

@simonswine
Copy link
Contributor Author

I have raised this PR: minio/minio-go#1585

@simonswine simonswine force-pushed the 20211115_better-s3-error-handling branch from 8930d8f to 886aa8d Compare November 16, 2021 17:08
@simonswine simonswine changed the title WIP: Forward S3 error messages, which are not in XML Update minio-go to forward S3 error messages, which are not in XML Nov 16, 2021
This ensure that S3 API errors are returned in detail even though if
they are not XML formatted.
@simonswine simonswine force-pushed the 20211115_better-s3-error-handling branch from 886aa8d to 1f8f255 Compare November 16, 2021 17:33
@simonswine simonswine marked this pull request as ready for review November 16, 2021 17:59
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the CHANGELOG and I've also checked the code diff for the features we use, and no bell ringed, so LGTM!

@pracucci pracucci merged commit 5d8d35a into main Nov 17, 2021
@pracucci pracucci deleted the 20211115_better-s3-error-handling branch November 17, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants