Sync gowebdav client with reva edge

This commit is contained in:
André Duffeck
2023-12-18 11:47:48 +01:00
parent 18d8d081b7
commit afd72228d1
4 changed files with 30 additions and 15 deletions

2
go.mod
View File

@@ -349,4 +349,4 @@ require (
replace github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348
replace github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215074047-b00689b28e5f
replace github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6

4
go.sum
View File

@@ -827,8 +827,8 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/aduffeck/gowebdav v0.0.0-20231215074047-b00689b28e5f h1:rxzQfsnLmEm5YnAf0KDoTmswnnTX9whwAsFT7n1I1kk=
github.com/aduffeck/gowebdav v0.0.0-20231215074047-b00689b28e5f/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6 h1:ws0yvsikTQdmheKINP16tBzAHdttrHwbz/q3Fgl9X1Y=
github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6/go.mod h1:bHA7t77X/QFExdeAnDzK6vKM34kEZAcE1OX4MfiwjkE=
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=

View File

@@ -196,11 +196,6 @@ func (c *Client) ReadDir(path string) ([]FileInfo, error) {
// ReadDirWithProps reads the contents of the directory at the given path, along with the specified properties.
func (c *Client) ReadDirWithProps(path string, props []string) ([]FileInfo, error) {
propfindprops := ""
if len(props) > 0 {
propfindprops = `<d:prop><d:` + strings.Join(props, "/><d:") + `/></d:prop>`
}
files := make([]FileInfo, 0)
skipSelf := true
parse := func(resp interface{}) error {
@@ -229,8 +224,21 @@ func (c *Client) ReadDirWithProps(path string, props []string) ([]FileInfo, erro
return nil
}
propXML := "<d:propfind xmlns:d='DAV:'>"
switch {
case len(props) > 0:
propXML += "<d:prop>"
for _, prop := range props {
propXML += "<d:" + prop + "/>"
}
propXML += "</d:prop>"
default:
propXML += "<allprop/>"
}
propXML += "</d:propfind>"
err := c.propfind(path, false,
`<d:propfind xmlns:d='DAV:'>`+propfindprops+`</d:propfind>`,
propXML,
&response{},
parse)
@@ -262,11 +270,18 @@ func (c *Client) StatWithProps(path string, props []string) (FileInfo, error) {
return nil
}
propXML := "<d:propfind xmlns:d='DAV:'><d:prop>"
for _, prop := range props {
propXML += "<d:" + prop + "/>"
propXML := "<d:propfind xmlns:d='DAV:'>"
switch {
case len(props) > 0:
propXML += "<d:prop>"
for _, prop := range props {
propXML += "<d:" + prop + "/>"
}
propXML += "</d:prop>"
default:
propXML += "<allprop/>"
}
propXML += "</d:prop></d:propfind>"
propXML += "</d:propfind>"
err := c.propfind(path, true,
propXML,

4
vendor/modules.txt vendored
View File

@@ -1721,7 +1721,7 @@ github.com/stretchr/objx
github.com/stretchr/testify/assert
github.com/stretchr/testify/mock
github.com/stretchr/testify/require
# github.com/studio-b12/gowebdav v0.0.0-20221015232716-17255f2e7423 => github.com/aduffeck/gowebdav v0.0.0-20231215074047-b00689b28e5f
# github.com/studio-b12/gowebdav v0.0.0-20221015232716-17255f2e7423 => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6
## explicit; go 1.17
github.com/studio-b12/gowebdav
# github.com/tchap/go-patricia/v2 v2.3.1
@@ -2298,4 +2298,4 @@ stash.kopano.io/kgol/oidc-go
## explicit; go 1.13
stash.kopano.io/kgol/rndm
# github.com/go-micro/plugins/v4/store/nats-js-kv => github.com/kobergj/plugins/v4/store/nats-js-kv v0.0.0-20231207143248-4d424e3ae348
# github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215074047-b00689b28e5f
# github.com/studio-b12/gowebdav => github.com/aduffeck/gowebdav v0.0.0-20231215102054-212d4a4374f6