ssh: fix path normalization on Windows (#6517)

This commit is contained in:
Batuhan Taskaya
2021-09-23 18:23:40 +03:00
committed by GitHub
parent 6d3045320b
commit 0bf1802d4b
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ class SSHFileSystem(FSSpecWrapper):
path_str = path.path
else:
path_str = super()._with_bucket(path)
return os.path.normpath(path_str)
return path_str
def _prepare_credentials(self, **config):
self.CAN_TRAVERSE = True
+20
View File
@@ -178,3 +178,23 @@ def test_ssh_multi_identity_files(mock_file):
def test_ssh_gss_auth(mock_file, config, expected_gss_auth):
fs = SSHFileSystem(**config)
assert fs.fs_args["gss_auth"] == expected_gss_auth
@pytest.mark.parametrize(
"url, path",
[
("ssh://a@b/", "/"),
("ssh://a@b:/", "/"),
("ssh://a@b/home", "/home"),
("ssh://a@b:/home", "/home"),
("ssh://a@b/home/tmp", "/home/tmp"),
("ssh://a@b:/home/tmp", "/home/tmp"),
("ssh://a@b/home/tmp/something", "/home/tmp/something"),
("ssh://a@b:/home/tmp/something", "/home/tmp/something"),
],
)
def test_ssh_fs_path_management(url, path):
fs = SSHFileSystem(host="x.y.z")
path_info = fs.PATH_CLS(url)
assert fs._with_bucket(path_info) == path