Parses a Borg object file into a metadata dict and data (decrypting, decompressing).
(self, args, repository, manifest)
| 224 | |
| 225 | @with_repository(compatibility=Manifest.NO_OPERATION_CHECK) |
| 226 | def do_debug_parse_obj(self, args, repository, manifest): |
| 227 | """Parses a Borg object file into a metadata dict and data (decrypting, decompressing).""" |
| 228 | |
| 229 | # get the object from id |
| 230 | hex_id = args.id |
| 231 | try: |
| 232 | id = hex_to_bin(hex_id, length=32) |
| 233 | except ValueError as err: |
| 234 | raise CommandError(f"object id {hex_id} is invalid [{str(err)}].") |
| 235 | |
| 236 | with open(args.object_path, "rb") as f: |
| 237 | cdata = f.read() |
| 238 | |
| 239 | repo_objs = manifest.repo_objs |
| 240 | meta, data = repo_objs.parse(id=id, cdata=cdata, ro_type=ROBJ_DONTCARE) |
| 241 | |
| 242 | with open(args.json_path, "w") as f: |
| 243 | json.dump(meta, f) |
| 244 | |
| 245 | with open(args.binary_path, "wb") as f: |
| 246 | f.write(data) |
| 247 | |
| 248 | @with_repository(compatibility=Manifest.NO_OPERATION_CHECK) |
| 249 | def do_debug_format_obj(self, args, repository, manifest): |
nothing calls this directly
no test coverage detected