浏览代码

Merge pull request #2264 from mnowster/2259-unicode-error-volume-paths

Handle non-ascii volume directories
mnowster 10 年之前
父节点
当前提交
64a2713714
共有 2 个文件被更改,包括 6 次插入1 次删除
  1. 1 1
      compose/config/config.py
  2. 5 0
      tests/unit/config/config_test.py

+ 1 - 1
compose/config/config.py

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

+ 5 - 0
tests/unit/config/config_test.py

@@ -573,6 +573,11 @@ class VolumeConfigTest(unittest.TestCase):
         }, working_dir='.')
         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):
     def config_name(self):