From 1b8eff37f4aa1ad3c337006f81bb36fde57adce2 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 23 Oct 2015 22:04:08 +0100 Subject: [PATCH] Don't use a long path for the [magic_folder]local.directory field. Signed-off-by: Daira Hopwood --- src/allmydata/scripts/magic_folder_cli.py | 4 +++- src/allmydata/test/test_cli_magic_folder.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/allmydata/scripts/magic_folder_cli.py b/src/allmydata/scripts/magic_folder_cli.py index 37aeec76..a9787a15 100644 --- a/src/allmydata/scripts/magic_folder_cli.py +++ b/src/allmydata/scripts/magic_folder_cli.py @@ -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): diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index bb284813..07e6ed7f 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -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): -- 2.45.2