MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / readProppatch

Function readProppatch

server/webdav/xml.go:496–519  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

494}
495
496func 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}

Callers 2

handleProppatchMethod · 0.85
TestReadProppatchFunction · 0.85

Calls 1

DecodeMethod · 0.80

Tested by 1

TestReadProppatchFunction · 0.68