14 lines
280 B
Go
14 lines
280 B
Go
|
package uriutil
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func JoinURIs(base string, parts ...string) string {
|
||
|
if len(base) < 8 || len(base) > 8 && base[:8] != "https://" {
|
||
|
base = "https://" + base
|
||
|
}
|
||
|
return fmt.Sprintf("%s/%s", strings.TrimRight(base, "/"), strings.Join(parts, "/"))
|
||
|
}
|