mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
internal: fix trailing slash getting removed in Client.ResolveHref
This commit is contained in:
parent
1d93353e3d
commit
9afa59dc22
@ -36,11 +36,17 @@ 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, "/")
|
||||||
|
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,
|
||||||
User: c.endpoint.User,
|
User: c.endpoint.User,
|
||||||
Host: c.endpoint.Host,
|
Host: c.endpoint.Host,
|
||||||
Path: path.Join(c.endpoint.Path, p),
|
Path: p,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user