mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
return appropriate errors upon parseErrors (#13831)
This commit is contained in:
parent
f6190d6751
commit
8591d17d82
@ -3533,9 +3533,11 @@ func (api objectAPIHandlers) PutObjectLegalHoldHandler(w http.ResponseWriter, r
|
||||
return
|
||||
}
|
||||
|
||||
legalHold, err := objectlock.ParseObjectLegalHold(r.Body)
|
||||
legalHold, err := objectlock.ParseObjectLegalHold(io.LimitReader(r.Body, r.ContentLength))
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
apiErr := errorCodes.ToAPIErr(ErrMalformedXML)
|
||||
apiErr.Description = err.Error()
|
||||
writeErrorResponse(ctx, w, apiErr, r.URL)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -535,7 +535,7 @@ func (l *ObjectLegalHold) IsEmpty() bool {
|
||||
func ParseObjectLegalHold(reader io.Reader) (hold *ObjectLegalHold, err error) {
|
||||
hold = &ObjectLegalHold{}
|
||||
if err = xml.NewDecoder(reader).Decode(hold); err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if !hold.Status.Valid() {
|
||||
|
Loading…
Reference in New Issue
Block a user