InvalidXMLError: message: "CompleteMultipartUploadResult" XML is not parsable #792
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Minio sometimes responds with newlines before the XML declaration. The
data
variable holds something like this:b'\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUploadResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Location>https://minio-api.example.com/storage/data.csv.gz</Location><Bucket>storage</Bucket><Key>data.csv.gz</Key><ETag>7c913063d32676ebb4356e68db88db20-3</ETag></CompleteMultipartUploadResult>'
xml.etree
can't parse such response with errorInvalidXMLError: message: "CompleteMultipartUploadResult" XML is not parsable. Message: XML or text declaration not at start of entity: line 32, column 0
. The solution is to strip white-space characters from the response.