internal: prevent empty endpoint path from resulting in "." sub-paths

This commit is contained in:
Simon Ser 2020-02-12 20:04:31 +01:00
parent 842acb3647
commit 7d0d522fa7
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -27,6 +27,10 @@ func NewClient(c *http.Client, endpoint string) (*Client, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if u.Path == "" {
// This is important to avoid issues with path.Join
u.Path = "/"
}
return &Client{http: c, endpoint: u}, nil return &Client{http: c, endpoint: u}, nil
} }