Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpandConfigDir ¶
ExpandConfigDir expands ~ to user home directory and returns absolute path
func GetUserCachePath ¶
GetUserCachePath returns the platform-specific user cache directory This follows the conventions of each operating system: - Linux/Unix: ~/.cache - macOS: ~/Library/Caches - Windows: %LOCALAPPDATA%
func GetUserConfigPath ¶
GetUserConfigPath returns the platform-specific user config directory This follows the conventions of each operating system: - Linux/Unix: ~/.config - macOS: ~/Library/Application Support - Windows: %APPDATA%
func GetUserPath ¶
GetUserPath returns the user's home directory path across all platforms It provides a consistent way to get the user directory regardless of the operating system
func SafeFileKey ¶ added in v0.260801.1
SafeFileKey maps an externally-supplied identifier to a basename that is safe to join into a directory path.
The identifiers this exists for do not come from us: IM platforms mint chat ids containing '@' or '/' (WhatsApp JIDs, Feishu ids), and a session id can be whatever a user typed after /resume. Joining one into a path unchecked is a directory traversal on both read and write — "../../etc/passwd" resolves outside the store.
Identifiers that are already safe (ASCII letters, digits, '_' and '-') pass through verbatim, so numeric chat ids and UUID session ids stay readable on disk and existing files keep resolving with no migration. Anything else is replaced by a SHA-256 digest: stable, collision-free in practice, and unable to escape the directory.
Note '.' is deliberately unsafe, so "." and ".." can never survive.
Types ¶
This section is empty.