remove unnecessary logs for truncated XML inputs (#16184)

This commit is contained in:
Harshavardhana 2022-12-07 08:30:52 -08:00 committed by GitHub
parent 9f71369b67
commit 90d35b70b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -231,7 +231,14 @@ func xmlDecoder(body io.Reader, v interface{}, size int64) error {
d := xml.NewDecoder(lbody)
// Ignore any encoding set in the XML body
d.CharsetReader = nopCharsetConverter
return d.Decode(v)
err := d.Decode(v)
if errors.Is(err, io.EOF) {
err = &xml.SyntaxError{
Line: 0,
Msg: err.Error(),
}
}
return err
}
// hasContentMD5 returns true if Content-MD5 header is set.