Raise exception if trying to extract a member that doesn't exist

This commit is contained in:
IamTheFij 2023-06-12 11:08:21 -07:00
parent de7fe72cec
commit dfc12ed79e

View File

@ -319,6 +319,9 @@ class PackageAdapter:
self._package.extractall(path=path) self._package.extractall(path=path)
return self.get_names() return self.get_names()
if missing_members := set(members) - set(self.get_names()):
raise ValueError(f"Missing members: {missing_members}")
if isinstance(self._package, ZipFile): if isinstance(self._package, ZipFile):
self._package.extractall(path=path, members=members) self._package.extractall(path=path, members=members)
if isinstance(self._package, TarFile): if isinstance(self._package, TarFile):