Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/archivefile/_adapters/_rar.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ def extractall(
names.add(name)
else:
raise KeyError(f"{name} not found in {self._file}")
self._rarfile.extractall(path=destination, members=names, pwd=self._password)
else:
self._rarfile.extractall(path=destination, pwd=self._password)

self._rarfile.extractall(path=destination, members=names, pwd=self._password)
return destination

def read_bytes(self, member: StrPath | ArchiveMember) -> bytes:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ def test_extractall(file: Path, tmp_path: Path) -> None:
dest = tmp_path / uuid4().hex
archive.extractall(path=dest)
control = tuple((dest / "pyanilist-main").rglob("*"))
control_paths_rel = tuple(member.relative_to(dest) for member in control)

with ArchiveFile(file) as archive:
dest2 = tmp_path / uuid4().hex
archive.extractall(destination=dest2)
members = tuple((dest / "pyanilist-main").rglob("*"))
assert control == members
members = tuple((dest2 / "pyanilist-main").rglob("*"))
member_paths_rel = tuple(member.relative_to(dest2) for member in members)
assert control_paths_rel == member_paths_rel


@parametrize_files
Expand Down
Loading