Documentation
¶
Index ¶
- func EnsureWithinOutputDir(outputDir, path string) (string, error)
- func IsWithin(root, target string) bool
- func RemoveIfWithin(outputDir, path string) error
- func RemoveIfWithinAbs(outputRoot, path string) error
- func ResolveOutputDir(projectDir, configured string) (string, error)
- func SafeJoin(outputDir, relPath string) (string, error)
- func SafeJoinWithRoot(outputRoot, relPath string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureWithinOutputDir ¶
EnsureWithinOutputDir returns an absolute path only if path is inside outputDir.
func RemoveIfWithin ¶
RemoveIfWithin deletes a file only if it resolves inside outputDir.
func RemoveIfWithinAbs ¶
RemoveIfWithinAbs deletes a file only if it resolves inside the given absolute outputRoot. Avoids the filepath.Abs call on outputRoot that RemoveIfWithin performs.
func ResolveOutputDir ¶
ResolveOutputDir resolves a configured build output directory and rejects locations that could erase or overwrite source/project state.
func SafeJoin ¶
SafeJoin resolves relPath under outputDir and rejects absolute paths, traversal, empty paths, and paths that escape the output directory.
func SafeJoinWithRoot ¶
SafeJoinWithRoot is like SafeJoin but accepts a pre-resolved absolute outputRoot, avoiding repeated filepath.Abs calls when the root is reused across many pages. outputRoot must be the result of filepath.Abs.
Types ¶
This section is empty.