MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / resolve_input_path

Function resolve_input_path

crates/opencode-server/src/routes.rs:2917–2928  ·  view source on GitHub ↗
(input: &str, root: &FsPath)

Source from the content-addressed store, hash-verified

2915}
2916
2917fn 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
2930fn is_within_root(path: &FsPath, root: &FsPath) -> bool {
2931 canonicalize_within_root(path, root).is_ok()

Callers 3

list_filesFunction · 0.85
read_fileFunction · 0.85
find_textFunction · 0.85

Calls 2

canonicalize_within_rootFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected