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 <JackTheGit@users.noreply.github.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user