From e590f4d05fdb46747e83e35e66a26d9f4aa0314d Mon Sep 17 00:00:00 2001 From: John Spray Date: Fri, 1 Apr 2016 14:27:31 +0100 Subject: [PATCH] pybind: fix unicode handling in CephFSVolumeClient::purge os.path.join is sensitive to string encoding, but just doing a straight substitution should not be. Signed-off-by: John Spray --- src/pybind/ceph_volume_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pybind/ceph_volume_client.py b/src/pybind/ceph_volume_client.py index 656dce5d3d4b9..e37c904f9dfb6 100644 --- a/src/pybind/ceph_volume_client.py +++ b/src/pybind/ceph_volume_client.py @@ -526,7 +526,10 @@ def rmtree(root_path): d = self.fs.readdir(dir_handle) while d: if d.d_name not in [".", ".."]: - d_full = os.path.join(root_path, d.d_name) + # Do not use os.path.join because it is sensitive + # to string encoding, we just pass through dnames + # as byte arrays + d_full = "{0}/{1}".format(root_path, d.d_name) if d.is_dir(): rmtree(d_full) else: