瀏覽代碼

cache sync: check archive TAM

Thomas Waldmann 2 年之前
父節點
當前提交
73eae8cc8b
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      src/borg/cache.py
  2. 1 1
      src/borg/testsuite/archiver.py

+ 2 - 1
src/borg/cache.py

@@ -726,7 +726,8 @@ class LocalCache(CacheStatsMixin):
             nonlocal processed_item_metadata_chunks
             csize, data = decrypted_repository.get(archive_id)
             chunk_idx.add(archive_id, 1, len(data), csize)
-            archive = ArchiveItem(internal_dict=msgpack.unpackb(data))
+            archive, verified = self.key.unpack_and_verify_archive(data, force_tam_not_required=True)
+            archive = ArchiveItem(internal_dict=archive)
             if archive.version != 1:
                 raise Exception('Unknown archive metadata version')
             sync = CacheSynchronizer(chunk_idx)

+ 1 - 1
src/borg/testsuite/archiver.py

@@ -1190,7 +1190,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         self.cmd('delete', '--cache-only', self.repository_location)
         create_json = json.loads(self.cmd('create', '--no-cache-sync', self.repository_location + '::test', 'input',
                                           '--json', '--error'))  # ignore experimental warning
-        info_json = json.loads(self.cmd('info', self.repository_location + '::test', '--json'))
+        info_json = json.loads(self.cmd('info', self.repository_location + '::test', '--json', '--error'))  # ign warn
         create_stats = create_json['cache']['stats']
         info_stats = info_json['cache']['stats']
         assert create_stats == info_stats