MCPcopy Index your code
hub / github.com/php/frankenphp / ensureLeadingSlash

Function ensureLeadingSlash

cgi.go:359–365  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

357const separator = string(filepath.Separator)
358
359func ensureLeadingSlash(path string) string {
360 if path == "" || path[0] == '/' {
361 return path
362 }
363
364 return "/" + path
365}
366
367// toUnsafeChar returns a *C.char pointing at the backing bytes the Go string.
368// If C does not store the string, it may be passed directly in a Cgo call (most efficient).

Callers 2

splitCgiPathFunction · 0.85
TestEnsureLeadingSlashFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEnsureLeadingSlashFunction · 0.68