MCPcopy Create free account
hub / github.com/chainreactors/spray / Dir

Function Dir

pkg/utils.go:358–371  ·  view source on GitHub ↗
(u string)

Source from the content-addressed store, hash-verified

356}
357
358func Dir(u string) string {
359 // 安全的获取目录, 不会额外处理多个"//", 并非用来获取上级目录
360 // /a /
361 // /a/ /a/
362 // a/ a/
363 // aaa /
364 if strings.HasSuffix(u, "/") {
365 return u
366 } else if i := strings.LastIndex(u, "/"); i == -1 {
367 return "/"
368 } else {
369 return u[:i+1]
370 }
371}
372
373func FormatURL(base, u string) string {
374 if strings.HasPrefix(u, "http") {

Callers 5

BuildMethod · 0.92
NewBrutePoolFunction · 0.92
doAppendRuleMethod · 0.92
RelaPathFunction · 0.85
FormatURLFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected