Skip to content

fix(fs_write): expand ~ and $HOME in write paths - #3933

Open
Devil1716 wants to merge 1 commit into
aws:mainfrom
Devil1716:fix/issue-1932-fs-write-tilde
Open

Devil1716 wants to merge 1 commit into
aws:mainfrom
Devil1716:fix/issue-1932-fs-write-tilde

Conversation

@Devil1716

Copy link
Copy Markdown

Summary

Expand a leading ~ or $HOME in fs_write path handling so writes (and the printed diff) resolve home the same way fs_read already does via sanitize_path_tool_arg.

Motivation

Fixes #1932 — fs_write failed on paths like ~/… while reads already expanded the home prefix.

Changes

  • Teach sanitize_path_tool_arg to expand a leading ~ or $HOME (shared by fs_read / fs_write)
  • Add unit coverage for tilde and $HOME write paths in fs_write tests

Test plan

  • Ran: cargo test -p chat_cli --bin chat_cli — fs_write::tests (14), test_tilde_path_expansion, test_format_path passed
  • CI green on this branch

Notes for reviewers

Diff is limited to path sanitization + tests; no unrelated refactors.


Checklist

  • Diff is minimal; no unrelated refactors
  • Matches project style / CONTRIBUTING
  • No secrets, credentials, or proprietary code
  • Commit messages are clear

fs_write failed while printing a diff for paths that start with ~/
because the literal tilde path was opened. Expand a leading ~ or
$HOME before file access, and cover that diff path with a unit test.

Co-authored-by: Sharan S <Devil1716@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: fs_write failing on paths with "~"

2 participants