pathutil

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsNonBlank

func AbsNonBlank(value string) (string, bool, error)

AbsNonBlank trims value and resolves it to an absolute path.

func CleanRelative

func CleanRelative(value string) (string, bool)

CleanRelative returns a cleaned, non-empty relative path and rejects paths that would escape their root. It intentionally mirrors the service's conservative historical check where any cleaned ".." prefix is unsafe.

func CleanSlashPath

func CleanSlashPath(value string) string

CleanSlashPath returns a cleaned slash-separated path for stable API output.

func IsUnsafeRelative

func IsUnsafeRelative(value string) bool

IsUnsafeRelative reports whether a path is absolute or escapes upward from a scoped root after cleaning.

func MatchSlashGlob

func MatchSlashGlob(rel, pattern string) bool

MatchSlashGlob matches a slash-separated relative path against a user-facing glob/path pattern. It supports direct path/base matches, *, **, prefix/**, and **/suffix forms in addition to filepath.Match checks.

func MatchesAnySlashGlob

func MatchesAnySlashGlob(rel string, patterns []string) bool

MatchesAnySlashGlob reports whether rel matches at least one slash-separated glob pattern using Goncho's filesystem watcher matching semantics.

func NormalizeSlashPattern

func NormalizeSlashPattern(value string) string

NormalizeSlashPattern trims whitespace, converts separators to slashes, and removes a leading ./ prefix from user-facing glob/path patterns.

func NormalizeSlashPatterns

func NormalizeSlashPatterns(values []string) []string

NormalizeSlashPatterns trims, slash-normalizes, de-duplicates, and drops empty user-facing glob/path patterns while preserving first-seen order.

func SlashBase

func SlashBase(value string) string

SlashBase returns the final path element from a slash-separated relative path.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL