mirror of
https://github.com/openai/codex.git
synced 2026-12-03 00:41:03 +00:00
fix(tui): adapt workspace preview to path uris
This commit is contained in:
@@ -117,9 +117,17 @@ pub(crate) async fn plan_workspace_mutation(
|
||||
});
|
||||
};
|
||||
let requested = current.cwd.join(path);
|
||||
let requested_uri =
|
||||
PathUri::from_abs_path(&requested).map_err(|err| WorkspaceMutationError {
|
||||
code: io_error_code(&err),
|
||||
message: err.to_string(),
|
||||
cwd: current.cwd.clone(),
|
||||
workspace_roots: current.workspace_roots.clone(),
|
||||
omitted_workspace_roots: 0,
|
||||
})?;
|
||||
let fs = environment.environment.get_filesystem();
|
||||
let canonical = fs
|
||||
.canonicalize(&requested, /*sandbox*/ None)
|
||||
.canonicalize(&requested_uri, /*sandbox*/ None)
|
||||
.await
|
||||
.map_err(|err| WorkspaceMutationError {
|
||||
code: io_error_code(&err),
|
||||
@@ -138,6 +146,15 @@ pub(crate) async fn plan_workspace_mutation(
|
||||
workspace_roots: current.workspace_roots.clone(),
|
||||
omitted_workspace_roots: 0,
|
||||
})?;
|
||||
let canonical = canonical
|
||||
.to_abs_path()
|
||||
.map_err(|err| WorkspaceMutationError {
|
||||
code: io_error_code(&err),
|
||||
message: err.to_string(),
|
||||
cwd: current.cwd.clone(),
|
||||
workspace_roots: current.workspace_roots.clone(),
|
||||
omitted_workspace_roots: 0,
|
||||
})?;
|
||||
if !metadata.is_directory {
|
||||
return Err(WorkspaceMutationError {
|
||||
code: "not_a_directory",
|
||||
|
||||
Reference in New Issue
Block a user