1
0
mirror of synced 2024-11-21 16:54:23 +01:00

parsers: Inherit the sandbox option when creating additional parsers

This commit is contained in:
Romain Vigier 2023-11-13 13:11:35 +01:00
parent e6564509e1
commit 7405955ab5
No known key found for this signature in database
GPG Key ID: EB8152444509C709
2 changed files with 3 additions and 0 deletions

View File

@ -161,6 +161,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
member_parser, _ = parser_factory.get_parser(full_path) # type: ignore member_parser, _ = parser_factory.get_parser(full_path) # type: ignore
if member_parser: if member_parser:
member_parser.sandbox = self.sandbox
local_meta = {**local_meta, **member_parser.get_meta()} local_meta = {**local_meta, **member_parser.get_meta()}
if local_meta: if local_meta:
@ -248,6 +249,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser):
abort = True abort = True
continue continue
else: else:
member_parser.sandbox = self.sandbox
if member_parser.remove_all() is False: if member_parser.remove_all() is False:
logging.warning("In file %s, something went wrong \ logging.warning("In file %s, something went wrong \
with the cleaning of %s \ with the cleaning of %s \

View File

@ -82,6 +82,7 @@ class FLACParser(MutagenParser):
with open(fname, 'wb') as f: with open(fname, 'wb') as f:
f.write(picture.data) f.write(picture.data)
p, _ = parser_factory.get_parser(fname) # type: ignore p, _ = parser_factory.get_parser(fname) # type: ignore
p.sandbox = self.sandbox
# Mypy chokes on ternaries :/ # Mypy chokes on ternaries :/
meta[name] = p.get_meta() if p else 'harmful data' # type: ignore meta[name] = p.get_meta() if p else 'harmful data' # type: ignore
os.remove(fname) os.remove(fname)