MCPcopy Index your code
hub / github.com/TruthHun/BookStack / JoinURI

Function JoinURI

utils/url.go:5–28  ·  view source on GitHub ↗
(elem ...string)

Source from the content-addressed store, hash-verified

3import "strings"
4
5func JoinURI(elem ...string) string {
6 if len(elem) <= 0 {
7 return ""
8 }
9 uri := ""
10
11 for i,u := range elem {
12 u = strings.Replace(u,"\\","/",-1)
13
14 if i == 0 {
15 if !strings.HasSuffix(u,"/") {
16 u = u + "/"
17 }
18 uri = u
19 }else{
20 u = strings.Replace(u,"//","/",-1)
21 if strings.HasPrefix(u,"/") {
22 u = string(u[1:])
23 }
24 uri += u
25 }
26 }
27 return uri
28}

Callers

nothing calls this directly

Calls 2

stringFunction · 0.85
ReplaceMethod · 0.45

Tested by

no test coverage detected