validation

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package validation provides input sanitization and validation utilities.

It includes functions for converting user-provided strings into safe values for use in filenames, paths, and other contexts where special characters could cause problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSymlinks(dir string) error

CheckSymlinks checks whether dir itself or any of its immediate children are symlinks. Returns an error describing the first symlink found.

func SanitizeFilename

func SanitizeFilename(s string) string

SanitizeFilename converts a topic string to a safe filename component.

Replaces spaces and special characters with hyphens, converts to lowercase, and limits length to 50 characters. Returns "session" if the input is empty.

Parameters:

  • s: Topic string to sanitize

Returns:

  • string: Safe filename component (lowercase, hyphenated, max 50 chars)

func ValidateBoundary added in v0.6.0

func ValidateBoundary(dir string) error

ValidateBoundary checks that dir resolves to a path within the current working directory. Returns an error if the resolved path escapes the project root.

Types

This section is empty.

Jump to

Keyboard shortcuts

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