flabk/util/uriutil/join.go

14 lines
280 B
Go
Raw Normal View History

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, "/"))
}