mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
21 lines
445 B
Go
21 lines
445 B
Go
package commonmdm
|
|
|
|
import (
|
|
"net/url"
|
|
"path"
|
|
)
|
|
|
|
// ResolveURL resolves a relative path to a server URL (typically the Fleet
|
|
// server's). If cleanQuery is true, the query string part is cleared.
|
|
func ResolveURL(serverURL, relPath string, cleanQuery bool) (string, error) {
|
|
u, err := url.Parse(serverURL)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
u.Path = path.Join(u.Path, relPath)
|
|
if cleanQuery {
|
|
u.RawQuery = ""
|
|
}
|
|
return u.String(), nil
|
|
}
|