MCPcopy Create free account
hub / github.com/bep/s3deploy / pathClean

Function pathClean

lib/url.go:94–101  ·  view source on GitHub ↗

pathClean works like path.Clean but will always preserve a trailing slash.

(p string)

Source from the content-addressed store, hash-verified

92
93// pathClean works like path.Clean but will always preserve a trailing slash.
94func pathClean(p string) string {
95 hadSlash := strings.HasSuffix(p, "/")
96 p = path.Clean(p)
97 if hadSlash && !strings.HasSuffix(p, "/") {
98 p += "/"
99 }
100 return p
101}
102
103// trimIndexHTML remaps paths matching "<dir>/index.html" to "<dir>/".
104func trimIndexHTML(p string) string {

Callers 2

TestPathCleanFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPathCleanFunction · 0.68