Return proper errors for invalid bodies (#7179)

This commit is contained in:
Harshavardhana
2019-01-31 07:19:09 -08:00
committed by kannappanr
parent 36dae04671
commit 432aec73d9
2 changed files with 23 additions and 21 deletions

View File

@@ -40,7 +40,7 @@ func parseLocationConstraint(r *http.Request) (location string, s3Error APIError
// be created at default region.
locationConstraint := createBucketLocationConfiguration{}
err := xmlDecoder(r.Body, &locationConstraint, r.ContentLength)
if err != nil && err != io.EOF {
if err != nil && r.ContentLength != 0 {
logger.LogIf(context.Background(), err)
// Treat all other failures as XML parsing errors.
return "", ErrMalformedXML