Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include symlink destination in path info. #169

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aioftp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ def parse_list_line_unix(self, b):
link_src = s[:i]
i = -2 if link_dst[-1] == "'" or link_dst[-1] == '"' else -1
info["type"] = "dir" if link_dst[i] == "/" else "file"
info["link_dst"] = link_dst
s = link_src
return pathlib.PurePosixPath(s), info

Expand Down
8 changes: 8 additions & 0 deletions tests/test_simple_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ def test_parse_list_line_unix():
with pytest.raises(ValueError):
p(b"-rw-rw-r-- xx poh poh 6595 Feb 27 04:14 history.rst")

_, parsed = p(b"lrwxrwxrwx 1 poh poh 6 Mar 23 05:46 link-tmp.py -> tmp.py")
assert parsed["type"] == "file"
assert parsed["link_dst"] == "tmp.py"

_, parsed = p(b"lrwxrwxrwx 1 poh poh 6 Mar 23 05:46 link-tmp.py -> /tmp.py")
assert parsed["type"] == "file"
assert parsed["link_dst"] == "/tmp.py"


@pytest.mark.parametrize("owner", ["s", "x", "-", "E"])
@pytest.mark.parametrize("group", ["s", "x", "-", "E"])
Expand Down