Skip to content

Commit

Permalink
Allow getting name as string from partition extent and do not exclude…
Browse files Browse the repository at this point in the history
… extents when getting extent data
  • Loading branch information
Zedeldi committed Oct 15, 2024
1 parent fc3c3fd commit ddc02b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions igelfs/models/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def get_type(self) -> ExtentType:
"""Return ExtentType from PartitionExtent instance."""
return ExtentType(self.type)

def get_name(self) -> str:
"""Return name of PartitionExtent instance as a string."""
return self.name.strip(b"\x00").decode()


@dataclass
class PartitionExtents(BaseDataModel):
Expand Down
4 changes: 2 additions & 2 deletions igelfs/models/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@ def get_extent_of(
offset -= partition.get_actual_size()
if hash_ := sections[0].hash:
offset -= hash_.get_actual_size()
data = cls.get_payload_of(sections)
return data[offset : extent.length]
data = cls.get_payload_of(sections, include_extents=True)
return data[offset : offset + extent.length]

0 comments on commit ddc02b8

Please sign in to comment.