diff --git a/dissect/target/containers/vdi.py b/dissect/target/containers/vdi.py index 4817bd54df..c8d4f2dfc1 100644 --- a/dissect/target/containers/vdi.py +++ b/dissect/target/containers/vdi.py @@ -17,11 +17,9 @@ class VdiContainer(Container): __type__ = "vdi" def __init__(self, fh: BinaryIO | Path, *args, **kwargs): - f = fh - if not hasattr(fh, "read"): - f = fh.open("rb") - self.vdi = vdi.VDI(f) + self.vdi = vdi.VDI(fh) + self._stream = self.vdi.open() super().__init__(fh, self.vdi.size, *args, **kwargs) @staticmethod @@ -33,13 +31,14 @@ def detect_path(path: Path, original: list | BinaryIO) -> bool: return path.suffix.lower() == ".vdi" def read(self, length: int) -> bytes: - return self.vdi.read(length) + return self._stream.read(length) def seek(self, offset: int, whence: int = io.SEEK_SET) -> int: - return self.vdi.seek(offset, whence) + return self._stream.seek(offset, whence) def tell(self) -> int: - return self.vdi.tell() + return self._stream.tell() def close(self) -> None: - pass + self._stream.close() + self.vdi.close() diff --git a/pyproject.toml b/pyproject.toml index b6a790b066..4e318cd1fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "dissect.database>=1.1.dev4,<2", # TODO: update on release! "dissect.eventlog>=3,<4", "dissect.evidence>=3.13.dev3,<4", # TODO: update on release! - "dissect.hypervisor>=3.21.dev3,<4", # TODO: update on release! + "dissect.hypervisor>=3.21.dev5,<4", # TODO: update on release! "dissect.ntfs>=3.16.dev,<4", "dissect.regf>=3.13,<4", "dissect.util>=3,<4",