pub fn validate_filepath(s: &str) -> Result<(), ValidationError>Expand description
Validate that s looks like a safe filesystem path string:
non-empty, no NUL bytes, no .. parent-directory segments (path
traversal). This is the structural half only — it does NOT
touch the filesystem, so the caller still has to verify
existence, readability and sandbox membership.
Accepted shapes:
- Relative:
docs/intro.md,assets/logo.png - Absolute (any platform):
/var/uploads/x.txt,C:\Users\me\f.txt - Trailing slash on directories
Rejected shapes:
- Empty string
- Strings containing
\0(also caught byvalidate_prohibit_null_characters) - Strings with a
..segment between separators (docs/../etc/passwd,../secret,a/../b)
§Errors
ValidationError { code: "invalid_filepath", ... } on any of the
rejected shapes above.