well-goknown/vendor/github.com/valyala/fasthttp/uri_windows.go

12 lines
237 B
Go

package fasthttp
func addLeadingSlash(dst, src []byte) []byte {
// zero length 、"C:/" and "a" case
isDisk := len(src) > 2 && src[1] == ':'
if len(src) == 0 || (!isDisk && src[0] != '/') {
dst = append(dst, '/')
}
return dst
}