Skip to content

fix: handle path protocols correctly in string_iter()#126

Open
sumanjeet0012 wants to merge 1 commit into
multiformats:masterfrom
sumanjeet0012:fix-issue-112
Open

fix: handle path protocols correctly in string_iter()#126
sumanjeet0012 wants to merge 1 commit into
multiformats:masterfrom
sumanjeet0012:fix-issue-112

Conversation

@sumanjeet0012

Copy link
Copy Markdown

Fixes #112

Description

This pull request ensures that string_iter() in multiaddr/transforms.py has the same handling for path protocols (e.g., unix) as Multiaddr._from_string(). Previously, it was only taking a single chunk of string as the protocol's value, which fails for paths containing multiple slashes (e.g., /unix/var/run/docker.sock). This update explicitly checks if a codec is a path (codec.IS_PATH) and if so, consumes all remaining components joined by slashes.

Changes

  • Updated string_iter() in multiaddr/transforms.py to use getattr(codec, \IS_PATH\, False) to check for path codecs and consume remaining parts appropriately.
  • Added test_string_iter_unix_path() in tests/test_transforms.py to explicitly verify the behavior of parsing a /unix/ path string.
  • Added a towncrier newsfragment newsfragments/112.bugfix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

string_iter() doesn't handle unix paths — inconsistent with _from_string()

1 participant