Documentation
¶
Index ¶
- func EnsureLeadingSlash(path string) string
- func IsAbsoluteURL(path string) bool
- func JoinBasePath(basePath, routePath string) string
- func JoinResolvedPath(basePath, suffix string) string
- func NormalizeBasePath(basePath string) string
- func NormalizeLocalPath(path string) (string, error)
- func OpenFileWithinRoot(root, path string) (*os.File, error)
- func PrefixBasePath(basePath, routePath string) string
- func ReadFileWithinRoot(root, path string) ([]byte, error)
- func ResolveWithinRoot(root, path string) (string, error)
- func TrimTrailingSlash(path string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureLeadingSlash ¶
EnsureLeadingSlash normalizes whitespace and ensures the path starts with '/'.
func IsAbsoluteURL ¶
IsAbsoluteURL reports whether the path is an absolute or scheme-relative URL.
func JoinBasePath ¶
JoinBasePath joins a normalized base path and route path without duplicating slashes.
func JoinResolvedPath ¶ added in v0.113.1
JoinResolvedPath appends a relative suffix to an already-resolved path or URL.
func NormalizeBasePath ¶
NormalizeBasePath trims and normalizes a base path into /segment form.
func NormalizeLocalPath ¶
NormalizeLocalPath trims and cleans a local file path.
func OpenFileWithinRoot ¶
OpenFileWithinRoot opens a file that must remain inside root.
func PrefixBasePath ¶
PrefixBasePath prefixes a route path with the base path unless already prefixed.
func ReadFileWithinRoot ¶
ReadFileWithinRoot reads a file that must remain inside root.
func ResolveWithinRoot ¶
ResolveWithinRoot resolves path under root and rejects escapes.
func TrimTrailingSlash ¶
TrimTrailingSlash removes one trailing slash except for the root path.
Types ¶
This section is empty.