pub async fn resolve_file_in_base(base: &Path, path: &str) -> Option<PathBuf>Expand description
Resolves a file path within a base directory with path-traversal protection.
Canonicalizes both the file path and the base directory, then verifies that the canonical file path starts with the canonical base directory.
§Arguments
&Path- The base directory to resolve within.&str- The relative path to the file.
§Returns
Option<PathBuf>- The resolved file path if valid,Noneotherwise.