]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Don't use a long path for the [magic_folder]local.directory field.
authorDaira Hopwood <daira@jacaranda.org>
Fri, 23 Oct 2015 21:04:08 +0000 (22:04 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 27 Oct 2015 19:34:19 +0000 (19:34 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/scripts/magic_folder_cli.py
src/allmydata/test/test_cli_magic_folder.py

index 37aeec76a59446893bb7e327f4b2545729b85819..a9787a15ca534dd64a2918a667dab4f16b7b3614 100644 (file)
@@ -136,7 +136,9 @@ class JoinOptions(BasedirOptions):
     magic_readonly_cap = ""
     def parseArgs(self, invite_code, local_dir):
         BasedirOptions.parseArgs(self)
-        self.local_dir = None if local_dir is None else argv_to_abspath(local_dir)
+
+        # Expand the path relative to the current directory of the CLI command, not the node.
+        self.local_dir = None if local_dir is None else argv_to_abspath(local_dir, long_path=False)
         self.invite_code = to_str(argv_to_unicode(invite_code))
 
 def join(options):
index bb2848132884d036349da66e8031a5fedcf5487e..07e6ed7f5a24762c12f0e5f482ffabc02932646f 100644 (file)
@@ -186,6 +186,7 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
         self.basedir = "cli/MagicFolder/create-and-then-invite-join"
         self.set_up_grid()
         local_dir = os.path.join(self.basedir, "magic")
+        abs_local_dir_u = abspath_expanduser_unicode(unicode(local_dir), long_path=False)
 
         d = self.do_create_magic_folder(0)
         d.addCallback(lambda ign: self.do_invite(0, u"Alice"))
@@ -197,7 +198,7 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
             self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0)
         d.addCallback(get_caps)
         d.addCallback(lambda ign: self.check_joined_config(0, self.upload_dircap))
-        d.addCallback(lambda ign: self.check_config(0, abspath_expanduser_unicode(unicode(local_dir))))
+        d.addCallback(lambda ign: self.check_config(0, abs_local_dir_u))
         return d
 
     def test_create_error(self):
@@ -215,6 +216,7 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
         self.basedir = "cli/MagicFolder/create-invite-join"
         self.set_up_grid()
         local_dir = os.path.join(self.basedir, "magic")
+        abs_local_dir_u = abspath_expanduser_unicode(unicode(local_dir), long_path=False)
 
         d = self.do_cli("magic-folder", "create", "magic:", "Alice", local_dir)
         def _done((rc, stdout, stderr)):
@@ -222,7 +224,7 @@ class CreateMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
             self.collective_dircap, self.upload_dircap = self.get_caps_from_files(0)
         d.addCallback(_done)
         d.addCallback(lambda ign: self.check_joined_config(0, self.upload_dircap))
-        d.addCallback(lambda ign: self.check_config(0, abspath_expanduser_unicode(unicode(local_dir))))
+        d.addCallback(lambda ign: self.check_config(0, abs_local_dir_u))
         return d
 
     def test_create_invite_join_failure(self):