Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Schamper committed Mar 18, 2024
1 parent afac4c0 commit 863e0e6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions dissect/archive/wim.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, fh: BinaryIO):
self.header = c_wim.WIMHEADER_V1_PACKED(fh)

if self.header.ImageTag != WIM_IMAGE_TAG:
raise InvalidHeaderError("Expected MSWIM header, got: {!r}".format(self.header.ImageTag))
raise InvalidHeaderError(f"Expected MSWIM header, got: {self.header.ImageTag!r}")

if self.header.Version != c_wim.VERSION_DEFAULT:
raise NotImplementedError(f"Only WIM version {c_wim.VERSION_DEFAULT:#x} is supported right now")
Expand Down Expand Up @@ -343,9 +343,13 @@ def iterdir(self) -> Iterator[DirectoryEntry]:
break

fh.seek(-8, io.SEEK_CUR)
yield DirectoryEntry(self.image, fh)
entry = DirectoryEntry(self.image, fh)
offset = fh.tell()

fh.seek((fh.tell() + 7) & (-8))
yield entry

# Align to the next 8 byte boundary
fh.seek((offset + 7) & (-8))

def open(self, name: str = "") -> BinaryIO:
"""Return a file-like object for the contents of this directory entry.
Expand Down

0 comments on commit 863e0e6

Please sign in to comment.