webdav: add recursive arg to Client.Readdir

This commit is contained in:
Simon Ser 2020-01-22 12:06:36 +01:00
parent f04c1c9421
commit fda38c8f93
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -124,10 +124,13 @@ func (c *Client) Open(name string) (io.ReadCloser, error) {
return resp.Body, nil
}
func (c *Client) Readdir(name string) ([]FileInfo, error) {
// TODO: filter out the directory we're listing
func (c *Client) Readdir(name string, recursive bool) ([]FileInfo, error) {
depth := internal.DepthOne
if recursive {
depth = internal.DepthInfinity
}
ms, err := c.ic.Propfind(name, internal.DepthOne, fileInfoPropfind)
ms, err := c.ic.Propfind(name, depth, fileInfoPropfind)
if err != nil {
return nil, err
}