mirror of https://github.com/minio/minio.git
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
legalHold, err := objectlock.ParseObjectLegalHold(r.Body)
|
legalHold, err := objectlock.ParseObjectLegalHold(io.LimitReader(r.Body, r.ContentLength))
|
||||||
if err != nil {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -535,7 +535,7 @@ func (l *ObjectLegalHold) IsEmpty() bool {
|
||||||
func ParseObjectLegalHold(reader io.Reader) (hold *ObjectLegalHold, err error) {
|
func ParseObjectLegalHold(reader io.Reader) (hold *ObjectLegalHold, err error) {
|
||||||
hold = &ObjectLegalHold{}
|
hold = &ObjectLegalHold{}
|
||||||
if err = xml.NewDecoder(reader).Decode(hold); err != nil {
|
if err = xml.NewDecoder(reader).Decode(hold); err != nil {
|
||||||
return
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !hold.Status.Valid() {
|
if !hold.Status.Valid() {
|
||||||
|
|
Loading…
Reference in New Issue