Documentation
¶
Overview ¶
Package uploadpath centralizes the on-disk location and filename sanitization for user-uploaded attachments so the WebUI upload handler and the Slack file-download path agree byte-for-byte.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
func Dir() string
Dir returns the directory where uploaded attachments are stored: {os.TempDir()}/kojo/upload. Callers create it on demand.
func SanitizeName ¶
SanitizeName reduces an arbitrary user-supplied filename to a single benign path component. The unified policy is:
- filepath.Base strips any directory components.
- "/", "\\" and NUL are replaced with "_".
- Any other control character (unicode.IsControl) is replaced with "_" — this blocks newline/escape-sequence injection through crafted names that later get echoed into prompts or logs.
- If the result would be "", "." or ".." (values that are unsafe as a bare path element), it is replaced with "_".
The output is safe to use directly as a filename component under Dir() and safe to join with a prefix ({unixnano}_{name}).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.