propfind

package
v2.16.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MultistatusResponse

func MultistatusResponse(ctx context.Context, pf *XML, mds []*provider.ResourceInfo, publicURL, ns string, linkshares map[string]struct{}, returnMinimal bool) ([]byte, error)

MultistatusResponse converts a list of resource infos into a multistatus response string

Types

type Handler

type Handler struct {
	PublicURL string
	// contains filtered or unexported fields
}

Handler handles propfind requests

func NewHandler

func NewHandler(publicURL string, selector pool.Selectable[gateway.GatewayAPIClient], c *config.Config) *Handler

NewHandler returns a new PropfindHandler instance

func (*Handler) HandlePathPropfind

func (p *Handler) HandlePathPropfind(w http.ResponseWriter, r *http.Request, ns string)

HandlePathPropfind handles a path based propfind request ns is the namespace that is prefixed to the path in the cs3 namespace

func (*Handler) HandleSpacesPropfind

func (p *Handler) HandleSpacesPropfind(w http.ResponseWriter, r *http.Request, spaceID string)

HandleSpacesPropfind handles a spaces based propfind request

type MultiStatusResponseUnmarshalXML

type MultiStatusResponseUnmarshalXML struct {
	XMLName xml.Name `xml:"multistatus"`
	XmlnsS  string   `xml:"xmlns:s,attr,omitempty"`
	XmlnsD  string   `xml:"xmlns:d,attr,omitempty"`
	XmlnsOC string   `xml:"xmlns:oc,attr,omitempty"`

	Responses []*ResponseUnmarshalXML `xml:"response"`
}

MultiStatusResponseUnmarshalXML is a workaround for https://github.com/golang/go/issues/13400

type MultiStatusResponseXML

type MultiStatusResponseXML struct {
	XMLName xml.Name `xml:"d:multistatus"`
	XmlnsS  string   `xml:"xmlns:s,attr,omitempty"`
	XmlnsD  string   `xml:"xmlns:d,attr,omitempty"`
	XmlnsOC string   `xml:"xmlns:oc,attr,omitempty"`

	Responses []*ResponseXML `xml:"d:response"`
}

MultiStatusResponseXML holds the xml representation of a multistatus propfind response

func NewMultiStatusResponseXML

func NewMultiStatusResponseXML() *MultiStatusResponseXML

NewMultiStatusResponseXML returns a preconfigured instance of MultiStatusResponseXML

type Props

type Props []xml.Name

Props represents properties related to a resource http://www.webdav.org/specs/rfc4918.html#ELEMENT_prop (for propfind)

func (*Props) UnmarshalXML

func (pn *Props) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML appends the property names enclosed within start to pn.

It returns an error if start does not contain any properties or if properties contain values. Character data between properties is ignored.

type PropstatUnmarshalXML

type PropstatUnmarshalXML struct {
	// Prop requires DAV: to be the default namespace in the enclosing
	// XML. This is due to the standard encoding/xml package currently
	// not honoring namespace declarations inside a xmltag with a
	// parent element for anonymous slice elements.
	// Use of multistatusWriter takes care of this.
	Prop                []*prop.PropertyXML `xml:"prop"`
	Status              string              `xml:"status"`
	Error               *errors.ErrorXML    `xml:"d:error"`
	ResponseDescription string              `xml:"responsedescription,omitempty"`
}

PropstatUnmarshalXML is a workaround for https://github.com/golang/go/issues/13400

type PropstatXML

type PropstatXML struct {
	// Prop requires DAV: to be the default namespace in the enclosing
	// XML. This is due to the standard encoding/xml package currently
	// not honoring namespace declarations inside a xmltag with a
	// parent element for anonymous slice elements.
	// Use of multistatusWriter takes care of this.
	Prop                []prop.PropertyXML `xml:"d:prop>_ignored_"`
	Status              string             `xml:"d:status"`
	Error               *errors.ErrorXML   `xml:"d:error"`
	ResponseDescription string             `xml:"d:responsedescription,omitempty"`
}

PropstatXML holds the xml representation of a propfind response http://www.webdav.org/specs/rfc4918.html#ELEMENT_propstat

type ResponseUnmarshalXML

type ResponseUnmarshalXML struct {
	XMLName             xml.Name               `xml:"response"`
	Href                string                 `xml:"href"`
	Propstat            []PropstatUnmarshalXML `xml:"propstat"`
	Status              string                 `xml:"status,omitempty"`
	Error               *errors.ErrorXML       `xml:"d:error"`
	ResponseDescription string                 `xml:"responsedescription,omitempty"`
}

ResponseUnmarshalXML is a workaround for https://github.com/golang/go/issues/13400

type ResponseXML

type ResponseXML struct {
	XMLName             xml.Name         `xml:"d:response"`
	Href                string           `xml:"d:href"`
	Propstat            []PropstatXML    `xml:"d:propstat"`
	Status              string           `xml:"d:status,omitempty"`
	Error               *errors.ErrorXML `xml:"d:error"`
	ResponseDescription string           `xml:"d:responsedescription,omitempty"`
}

ResponseXML holds the xml representation of a propfind response

type XML

type XML struct {
	XMLName  xml.Name  `xml:"DAV: propfind"`
	Allprop  *struct{} `xml:"DAV: allprop"`
	Propname *struct{} `xml:"DAV: propname"`
	Prop     Props     `xml:"DAV: prop"`
	Include  Props     `xml:"DAV: include"`
}

XML holds the xml representation of a propfind http://www.webdav.org/specs/rfc4918.html#ELEMENT_propfind

func ReadPropfind

func ReadPropfind(r io.Reader) (pf XML, status int, err error)

ReadPropfind extracts and parses the propfind XML information from a Reader from https://github.com/golang/net/blob/e514e69ffb8bc3c76a71ae40de0118d794855992/webdav/xml.go#L178-L205

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL