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

Function SafePath

pkg/utils.go:313–320  ·  view source on GitHub ↗
(dir, u string)

Source from the content-addressed store, hash-verified

311}
312
313func SafePath(dir, u string) string {
314 hasSlash := strings.HasPrefix(u, "/")
315 if hasSlash {
316 return dir + u[1:]
317 } else {
318 return dir + u
319 }
320}
321
322func RelaPath(base, u string) string {
323 // 拼接相对目录, 不使用path.join的原因是, 如果存在"////"这样的情况, 可能真的是有意义的路由, 不能随意去掉.

Callers 3

BuildMethod · 0.92
safePathMethod · 0.92
doAppendWordsMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected