Handle non-ascii chars in volume directories

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
Mazz Mosley 2015-10-27 17:37:48 +00:00
parent 0b25014020
commit 5dc14f3925
2 changed files with 6 additions and 1 deletions

View File

@ -505,7 +505,7 @@ def resolve_volume_path(volume, working_dir, service_name):
if host_path.startswith('.'): if host_path.startswith('.'):
host_path = expand_path(working_dir, host_path) host_path = expand_path(working_dir, host_path)
host_path = os.path.expanduser(host_path) host_path = os.path.expanduser(host_path)
return "{}:{}".format(host_path, container_path) return u"{}:{}".format(host_path, container_path)
else: else:
return container_path return container_path

View File

@ -573,6 +573,11 @@ class VolumeConfigTest(unittest.TestCase):
}, working_dir='.') }, working_dir='.')
self.assertEqual(d['volumes'], ['~:/data']) self.assertEqual(d['volumes'], ['~:/data'])
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
container_path = config.resolve_volume_path(volume, ".", "test")
self.assertEqual(container_path, volume)
class MergePathMappingTest(object): class MergePathMappingTest(object):
def config_name(self): def config_name(self):