utils

package
v0.45.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPathEscapesBase = errors.New("path escapes base directory")

ErrPathEscapesBase is returned when a path is outside the expected base directory.

Functions

func EnsureSubPath added in v0.45.0

func EnsureSubPath(base, path string) error

EnsureSubPath returns an error if path is not contained within base. This prevents path traversal attacks where user-controlled data could escape the intended directory.

func IsSimilarWord

func IsSimilarWord(given string, suggestion string) bool

IsSimilarWord calculates "The Levenshtein Distance" between two strings which represents the minimum total cost of edits that would convert the first string into the second. If the distance is less than 3, the word is considered misspelled.

func RemoveIgnoreNonExistent added in v0.28.0

func RemoveIgnoreNonExistent(file string) error

RemoveIgnoreNonExistent removes a file, ignoring if it doesn't exist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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