From d9a7b83ae3ddf8c5e6182e61e4c6c42987433136 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 17 Mar 2026 02:57:02 -0700 Subject: [PATCH] fix: make _is_write_denied robust to Path objects (#1678) Cast path to str() before os.path.expanduser() to handle pathlib.Path inputs safely. Based on PR #1051 by JackTheGit. Co-authored-by: JackTheGit --- tools/file_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/file_operations.py b/tools/file_operations.py index 7f39a027..56ed1319 100644 --- a/tools/file_operations.py +++ b/tools/file_operations.py @@ -94,7 +94,7 @@ def _get_safe_write_root() -> Optional[str]: def _is_write_denied(path: str) -> bool: """Return True if path is on the write deny list.""" - resolved = os.path.realpath(os.path.expanduser(path)) + resolved = os.path.realpath(os.path.expanduser(str(path))) # 1) Static deny list if resolved in WRITE_DENIED_PATHS: