Skip to content

Commit

Permalink
fix(src): handle addresses with zone id
Browse files Browse the repository at this point in the history
Ignore the zone id from the string presentation of the address as
instances of the UdpAddress are only constructed within context of an
interface and the interface is provided as constructor parameter

fixes #184
closes #185
  • Loading branch information
christgau committed Dec 8, 2023
1 parent 55fe3e6 commit c66a914
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Handle addresses with zone id by ignoring the interface part (#184)

## [0.7.1] - 2023-03-04

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/wsdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class NetworkAddress:

def __init__(self, family: int, raw: Union[bytes, str], interface: NetworkInterface) -> None:
self._family = family
self._raw_address = raw if isinstance(raw, bytes) else socket.inet_pton(family, raw)
self._raw_address = raw if isinstance(raw, bytes) else socket.inet_pton(family, raw.partition('%')[0])
self._interface = interface

self._address_str = socket.inet_ntop(self._family, self._raw_address)
Expand Down

0 comments on commit c66a914

Please sign in to comment.