| 494 | } |
| 495 | |
| 496 | func readProppatch(r io.Reader) (patches []Proppatch, status int, err error) { |
| 497 | var pu propertyupdate |
| 498 | if err = ixml.NewDecoder(r).Decode(&pu); err != nil { |
| 499 | return nil, http.StatusBadRequest, err |
| 500 | } |
| 501 | for _, op := range pu.SetRemove { |
| 502 | remove := false |
| 503 | switch op.XMLName { |
| 504 | case ixml.Name{Space: "DAV:", Local: "set"}: |
| 505 | // No-op. |
| 506 | case ixml.Name{Space: "DAV:", Local: "remove"}: |
| 507 | for _, p := range op.Prop { |
| 508 | if len(p.InnerXML) > 0 { |
| 509 | return nil, http.StatusBadRequest, errInvalidProppatch |
| 510 | } |
| 511 | } |
| 512 | remove = true |
| 513 | default: |
| 514 | return nil, http.StatusBadRequest, errInvalidProppatch |
| 515 | } |
| 516 | patches = append(patches, Proppatch{Remove: remove, Props: op.Prop}) |
| 517 | } |
| 518 | return patches, 0, nil |
| 519 | } |