outputpath

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureWithinOutputDir

func EnsureWithinOutputDir(outputDir, path string) (string, error)

EnsureWithinOutputDir returns an absolute path only if path is inside outputDir.

func IsWithin

func IsWithin(root, target string) bool

IsWithin reports whether target is equal to or inside root.

func RemoveIfWithin

func RemoveIfWithin(outputDir, path string) error

RemoveIfWithin deletes a file only if it resolves inside outputDir.

func RemoveIfWithinAbs

func RemoveIfWithinAbs(outputRoot, path string) error

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

func ResolveOutputDir(projectDir, configured string) (string, error)

ResolveOutputDir resolves a configured build output directory and rejects locations that could erase or overwrite source/project state.

func SafeJoin

func SafeJoin(outputDir, relPath string) (string, error)

SafeJoin resolves relPath under outputDir and rejects absolute paths, traversal, empty paths, and paths that escape the output directory.

func SafeJoinWithRoot

func SafeJoinWithRoot(outputRoot, relPath string) (string, error)

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.

Jump to

Keyboard shortcuts

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