Skip to content

Avoid returning non-directory paths from find_mount_point - #126

Open
M-Colley wants to merge 1 commit into
arsenetar:masterfrom
M-Colley:fix/issue-27-mount-point-not-dir
Open

M-Colley wants to merge 1 commit into
arsenetar:masterfrom
M-Colley:fix/issue-27-mount-point-not-dir

Conversation

@M-Colley

Copy link
Copy Markdown

Trashing a container-mounted file in the Freedesktop backend raised NotADirectoryError when os.path.ismount returned True for the file path itself. Specifically, find_mount_point returned that file path directly, and find_ext_volume_trash then called os.makedirs beneath the file. Fixes #27.

This change updates find_mount_point in send2trash/plat_other.py to walk parent directories until the candidate path is both a directory and a mount point. Additionally, a root guard stops traversal when os.path.split reaches a fixed point. Unit tests in tests/test_plat_other_unit.py verify that find_mount_point and send2trash resolve the enclosing mount directory and create the external trash folder there.

Signed-off-by: Mark Colley <39366189+M-Colley@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.

Deleting file fails

1 participant