Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove white-space characters before parsing XML (#792)
Minio sometimes responds with newlines before the XML declaration. The `data` variable holds something like `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></Co...'` and lxml can't parse such response with error `InvalidXMLError: 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 begining of the response.
- Loading branch information