Expand description
Sanitization boundary: remote bytes are hostile terminal input. Everything the UI draws from network/disk passes through here (PLAN.md §9).
Functions§
- is_
binary - Heuristic binary detection: NUL byte or >10% C0/C1 control chars (excluding \n, \t, \r) in the first 8 KiB.
- sanitize
- Lossy UTF-8 decode + strip C0/C1 controls except \n and \t. Critically strips ESC (\x1b): a single escape byte in file content would inject terminal sequences and corrupt the whole screen.
- sanitize_
inline - Single-line variant for names (file/dir entries): drops \n and \t too.