add URL utils

This commit is contained in:
aler9
2020-10-31 14:56:31 +01:00
parent 75db154a17
commit d85cfae2ed
5 changed files with 206 additions and 28 deletions

View File

@@ -464,26 +464,7 @@ func (c *ConnClient) urlForTrack(baseUrl *url.URL, mode TransportMode, track *Tr
RawPath: baseUrl.RawPath,
RawQuery: baseUrl.RawQuery,
}
// insert the control at the end of the url
if u.RawQuery != "" {
if !strings.HasSuffix(u.RawQuery, "/") {
u.RawQuery += "/"
}
u.RawQuery += control
} else if u.RawPath != "" {
if !strings.HasSuffix(u.RawPath, "/") {
u.RawPath += "/"
}
u.RawPath += control
} else {
if !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
}
u.Path += control
}
base.URLAddControlPath(u, control)
return u
}