(input: &str, root: &FsPath)
| 2915 | } |
| 2916 | |
| 2917 | fn resolve_input_path(input: &str, root: &FsPath) -> Result<PathBuf> { |
| 2918 | let path = PathBuf::from(input); |
| 2919 | let resolved = if path.is_absolute() { |
| 2920 | path |
| 2921 | } else { |
| 2922 | root.join(path) |
| 2923 | }; |
| 2924 | if !resolved.exists() { |
| 2925 | return Err(ApiError::NotFound("File not found".to_string())); |
| 2926 | } |
| 2927 | canonicalize_within_root(&resolved, root) |
| 2928 | } |
| 2929 | |
| 2930 | fn is_within_root(path: &FsPath, root: &FsPath) -> bool { |
| 2931 | canonicalize_within_root(path, root).is_ok() |
no test coverage detected