浏览代码

Merge fixes

Marian Beermann 9 年之前
父节点
当前提交
cd17602069
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. 3 3
      src/borg/archive.py
  2. 2 2
      src/borg/archiver.py
  3. 2 2
      src/borg/platform/windows.pyx

+ 3 - 3
src/borg/archive.py

@@ -432,12 +432,12 @@ Number of files: {0.stats.nfiles}'''.format(
                     sys.stdout.buffer.flush()
             if has_damaged_chunks:
                 logger.warning('File %s has damaged (all-zero) chunks. Try running borg check --repair.' %
-                               remove_surrogates(item[b'path']))
+                               remove_surrogates(item.path))
             return
 
         original_path = original_path or item.path
         dest = self.cwd
-        if item[b'path'].startswith('/') or item[b'path'].startswith('..') or (sys.platform == 'win32' and len(item[b'path']) > 1 and item[b'path'][1] == ':'):
+        if item.path.startswith('/') or item.path.startswith('..') or (sys.platform == 'win32' and len(item.path) > 1 and item.path[1] == ':'):
             raise Exception('Path should be relative and local')
         path = os.path.join(dest, item.path)
         # Attempt to remove existing files, ignore errors on failure
@@ -552,7 +552,7 @@ Number of files: {0.stats.nfiles}'''.format(
                 pass
         else:
             try:
-                set_owner(path, item[b'user'], safe_decode(item[b'uid']))
+                set_owner(path, item.user, safe_decode(item.uid))
             except OSError:
                 pass
         if sys.platform != 'win32':

+ 2 - 2
src/borg/archiver.py

@@ -452,7 +452,7 @@ class Archiver:
                     try:
                         archive.extract_item(dir_item, stdout=stdout)
                     except BackupOSError as e:
-                        self.print_warning('%s: %s', remove_surrogates(dir_item[b'path']), e)
+                        self.print_warning('%s: %s', remove_surrogates(dir_item.path), e)
             if output_list:
                 logging.getLogger('borg.output.list').info(remove_surrogates(orig_path))
             try:
@@ -474,7 +474,7 @@ class Archiver:
                 try:
                     archive.extract_item(dir_item)
                 except BackupOSError as e:
-                    self.print_warning('%s: %s', remove_surrogates(dir_item[b'path']), e)
+                    self.print_warning('%s: %s', remove_surrogates(dir_item.path), e)
         for pattern in include_patterns:
             if pattern.match_count == 0:
                 self.print_warning("Include pattern '%s' never matched.", pattern)

+ 2 - 2
src/borg/platform/windows.pyx

@@ -300,7 +300,7 @@ def acl_get(path, item, st, numeric_owner=False):
             continue
         permissions = {'user': {'name': name, 'sid': sidstr}, 'permissions': (ACEs[i].grfAccessPermissions, ACEs[i].grfAccessMode, ACEs[i].grfInheritance)}
         pyDACL.append(permissions)
-    item[b'win_dacl'] = safe_encode(json.dumps(pyDACL))
+    item.win_dacl = safe_encode(json.dumps(pyDACL))
 
     free(SD)
     LocalFree(<HLOCAL>ACEs)
@@ -310,7 +310,7 @@ def acl_set(path, item, numeric_owner=False):
     if b'win_dacl' not in item:
         return
 
-    pyDACL = json.loads(safe_decode(item[b'win_dacl']))
+    pyDACL = json.loads(safe_decode(item.win_dacl))
     cdef _EXPLICIT_ACCESS_W* ACEs = <_EXPLICIT_ACCESS_W*>calloc(sizeof(_EXPLICIT_ACCESS_W), len(pyDACL))
     cdef wchar_t* temp
     cdef PSID newsid