pub fn validate_filename(
filename: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>Expand description
Validate that a filename is safe and valid.
§Errors
Returns an error if the filename:
- Is empty
- Contains directory separators
- Contains null bytes
- Contains path traversal sequences (
..) - Exceeds 255 bytes
- Matches a Windows reserved name (CON, NUL, COM1–9, LPT1–9, etc.)