diff --git a/src/aioftp/client.py b/src/aioftp/client.py index c9b1e49..2f06459 100644 --- a/src/aioftp/client.py +++ b/src/aioftp/client.py @@ -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 diff --git a/tests/test_simple_functions.py b/tests/test_simple_functions.py index 7a55d87..4ec5777 100644 --- a/tests/test_simple_functions.py +++ b/tests/test_simple_functions.py @@ -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"])