pub fn sanitize_path(path: &str) -> StringExpand description
Sanitize a file path by removing dangerous components.
§Transformations
- Removes null bytes
- Replaces “..” with empty string
- Normalizes path separators
- Removes leading slashes (makes relative)
§Examples
use data_modelling_core::validation::input::sanitize_path;
assert_eq!(sanitize_path("data/file.json"), "data/file.json");
assert_eq!(sanitize_path("../data/file.json"), "data/file.json");
assert_eq!(sanitize_path("/absolute/path"), "absolute/path");