From 7405955ab5995b06c929148f0439670c9be7cb2d Mon Sep 17 00:00:00 2001 From: Romain Vigier Date: Mon, 13 Nov 2023 13:11:35 +0100 Subject: [PATCH] parsers: Inherit the sandbox option when creating additional parsers --- libmat2/archive.py | 2 ++ libmat2/audio.py | 1 + 2 files changed, 3 insertions(+) diff --git a/libmat2/archive.py b/libmat2/archive.py index 5978846..13f9188 100644 --- a/libmat2/archive.py +++ b/libmat2/archive.py @@ -161,6 +161,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): member_parser, _ = parser_factory.get_parser(full_path) # type: ignore if member_parser: + member_parser.sandbox = self.sandbox local_meta = {**local_meta, **member_parser.get_meta()} if local_meta: @@ -248,6 +249,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): abort = True continue else: + member_parser.sandbox = self.sandbox if member_parser.remove_all() is False: logging.warning("In file %s, something went wrong \ with the cleaning of %s \ diff --git a/libmat2/audio.py b/libmat2/audio.py index 13ed291..4e447c5 100644 --- a/libmat2/audio.py +++ b/libmat2/audio.py @@ -82,6 +82,7 @@ class FLACParser(MutagenParser): with open(fname, 'wb') as f: f.write(picture.data) p, _ = parser_factory.get_parser(fname) # type: ignore + p.sandbox = self.sandbox # Mypy chokes on ternaries :/ meta[name] = p.get_meta() if p else 'harmful data' # type: ignore os.remove(fname)