mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
internal: only handle relative paths in Client.ResolveHref
Don't prepend the endpoint path in front of absolute paths.
This commit is contained in:
parent
0b2d0a706c
commit
a892cc58df
@ -71,7 +71,7 @@ func (c *Client) SetBasicAuth(username, password string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) HasSupport() error {
|
func (c *Client) HasSupport() error {
|
||||||
classes, _, err := c.ic.Options("/")
|
classes, _, err := c.ic.Options("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func (c *Client) SetBasicAuth(username, password string) {
|
|||||||
func (c *Client) FindCurrentUserPrincipal() (string, error) {
|
func (c *Client) FindCurrentUserPrincipal() (string, error) {
|
||||||
propfind := internal.NewPropNamePropfind(internal.CurrentUserPrincipalName)
|
propfind := internal.NewPropNamePropfind(internal.CurrentUserPrincipalName)
|
||||||
|
|
||||||
resp, err := c.ic.PropfindFlat("/", propfind)
|
resp, err := c.ic.PropfindFlat("", propfind)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,8 @@ func (c *Client) SetBasicAuth(username, password string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) ResolveHref(p string) *url.URL {
|
func (c *Client) ResolveHref(p string) *url.URL {
|
||||||
trailingSlash := strings.HasSuffix(p, "/")
|
if !strings.HasPrefix(p, "/") {
|
||||||
p = path.Join(c.endpoint.Path, p)
|
p = path.Join(c.endpoint.Path, p)
|
||||||
// path.Join trims any trailing slash
|
|
||||||
if trailingSlash {
|
|
||||||
p += "/"
|
|
||||||
}
|
}
|
||||||
return &url.URL{
|
return &url.URL{
|
||||||
Scheme: c.endpoint.Scheme,
|
Scheme: c.endpoint.Scheme,
|
||||||
|
Loading…
Reference in New Issue
Block a user