浏览代码

Merge pull request #1296 from enkore/issue/1295

fuse: fix directories being shadowed when contained paths where also …
enkore 9 年之前
父节点
当前提交
9b4bf8d799
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      borg/fuse.py

+ 10 - 0
borg/fuse.py

@@ -76,6 +76,16 @@ class FuseOperations(llfuse.Operations):
             data = self.key.decrypt(key, chunk)
             unpacker.feed(data)
             for item in unpacker:
+                try:
+                    # This can happen if an archive was created with a command line like
+                    # $ borg create ... dir1/file dir1
+                    # In this case the code below will have created a default_dir inode for dir1 already.
+                    inode = self._find_inode(item[b'path'], prefix)
+                except KeyError:
+                    pass
+                else:
+                    self.items[inode] = item
+                    continue
                 segments = prefix + os.fsencode(os.path.normpath(item[b'path'])).split(b'/')
                 del item[b'path']
                 num_segments = len(segments)