瀏覽代碼

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 '../'.

(cherry picked from commit 60e924910034b86d3d9c6e9af706e5559cdb4d19)
Thomas Waldmann 7 年之前
父節點
當前提交
a0c576d7b9
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      borg/archive.py

+ 1 - 1
borg/archive.py

@@ -374,7 +374,7 @@ Number of files: {0.stats.nfiles}'''.format(
             return
 
         dest = self.cwd
-        if item[b'path'].startswith('/') or item[b'path'].startswith('..'):
+        if item[b'path'].startswith(('/', '../')):
             raise Exception('Path should be relative and local')
         path = os.path.join(dest, item[b'path'])
         # Attempt to remove existing files, ignore errors on failure