From 22b9c5c932543c0c1dd46ecff47864c56c47aefc Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 29 Oct 2021 12:40:18 +0200 Subject: [PATCH] [models] Skip over unknown data in manifest --- legendary/models/manifest.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/legendary/models/manifest.py b/legendary/models/manifest.py index ad3d54a..3e49867 100644 --- a/legendary/models/manifest.py +++ b/legendary/models/manifest.py @@ -526,8 +526,12 @@ class FML: for fm in _fml.elements: fm.file_size = sum(c.size for c in fm.chunk_parts) - if bio.tell() - fml_start != _fml.size: - raise ValueError('Did not read entire chunk data list!') + if (size_read := bio.tell() - fml_start) != _fml.size: + logger.warning(f'Did not read entire file data list! Version: {_fml.version}, ' + f'{_fml.size - size_read} bytes missing, skipping...') + bio.seek(_fml.size - size_read, 1) + # downgrade version to prevent issues during serialisation + _fml.version = 1 return _fml