pathkey

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmpty        = errors.New("namespace path must not be empty")
	ErrAbsolute     = errors.New("namespace path must be relative")
	ErrEscape       = errors.New("namespace path must not escape root")
	ErrEmptyPart    = errors.New("namespace path contains an empty segment")
	ErrPathConflict = errors.New("namespace path conflicts by case-folded key")
	// ErrDangling marks a symlink (or path) whose target does not exist. It is
	// distinct from ErrEscape so callers can warn (dangling) rather than block
	// (escape).
	ErrDangling = errors.New("symlink target does not exist")
)

Functions

func CheckSymlinkWithinRoot

func CheckSymlinkWithinRoot(root, path string) error

CheckSymlinkWithinRoot resolves path through symlinks and verifies the real target stays within root. It returns typed errors so callers can react precisely: ErrEscape (target outside root — block), ErrDangling (target missing — warn), or a wrapped IO error. errors.Is works against the sentinels.

func DetectCaseConflicts

func DetectCaseConflicts(paths []Path) error

func VerifyWithinRoot

func VerifyWithinRoot(root, target string) error

VerifyWithinRoot re-validates, at use time, that target resolves to a real path inside root. It closes the TOCTOU window between an earlier scan-time check and a later materialization (hydrate/worktree) by re-resolving symlinks immediately before use. Returns ErrEscape when target escapes root.

Types

type Path

type Path struct {
	Display string
	Key     string
}

func Clean

func Clean(input string) (Path, error)

func FromRoot

func FromRoot(root, path string) (Path, error)

Jump to

Keyboard shortcuts

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