From e5c0427c14bc666b2928afb14403e4210710eed8 Mon Sep 17 00:00:00 2001 From: Thomas Marchand Date: Sat, 17 Jan 2026 14:53:46 +0000 Subject: [PATCH] Fix file uploads not reaching container workspaces resolve_upload_base was using container-relative paths (e.g., /workspaces/...) directly on the host filesystem. Added the same container path mapping logic that resolve_download_path uses to correctly map to host paths. --- src/api/fs.rs | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/api/fs.rs b/src/api/fs.rs index fb74c6d..6a2f83b 100644 --- a/src/api/fs.rs +++ b/src/api/fs.rs @@ -182,8 +182,27 @@ fn resolve_upload_base(path: &str) -> Result { // Relative path -> resolve against current workspace working dir if known if let Some(state) = load_runtime_workspace() { - if let Some(wd) = state.working_dir { - return Ok(PathBuf::from(wd).join(path)); + if let Some(wd) = state + .working_dir + .as_ref() + .map(|s| s.trim()) + .filter(|s| !s.is_empty()) + { + let base = PathBuf::from(wd); + // For container workspaces, map container path back to host path + if is_container_workspace(&state) { + if let Some(mapped_base) = map_container_path_to_host(&base, &state) { + return Ok(mapped_base.join(path)); + } + } + return Ok(base.join(path)); + } + + // Fallback: use workspace root directly for container workspaces + if is_container_workspace(&state) { + if let Some(root) = workspace_root_path(&state) { + return Ok(root.join(path)); + } } }