From 60e924910034b86d3d9c6e9af706e5559cdb4d19 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 10 Oct 2017 01:36:44 +0200 Subject: [PATCH] fix detection of non-local path, fixes #3108 filenames like ..foobar are valid, so, to detect stuff in upper dirs, we need to include the path separator and check if it starts with '../'. --- src/borg/archive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 9bb2b8b1f..9d2c78387 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -557,7 +557,7 @@ def extract_item(self, item, restore_attrs=True, dry_run=False, stdout=False, sp original_path = original_path or item.path dest = self.cwd - if item.path.startswith(('/', '..')): + if item.path.startswith(('/', '../')): raise Exception('Path should be relative and local') path = os.path.join(dest, item.path) # Attempt to remove existing files, ignore errors on failure