diff --git a/specklepy/api/credentials.py b/specklepy/api/credentials.py index 3bdc188..6da65c4 100644 --- a/specklepy/api/credentials.py +++ b/specklepy/api/credentials.py @@ -144,9 +144,9 @@ class StreamWrapper: parsed = urlparse(url) self.host = parsed.netloc self.use_ssl = parsed.scheme == "https" - segments = parsed.path.strip("/").split("/") + segments = parsed.path.strip("/").split("/", 3) - if not segments or len(segments) > 4 or len(segments) < 2: + if not segments or len(segments) < 2: raise SpeckleException( f"Cannot parse {url} into a stream wrapper class - invalid URL provided." ) diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index c447846..54818b6 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py @@ -18,6 +18,14 @@ class TestWrapper: assert wacky_wrap.branch_name == "🍕⬅🌟 you wat?" assert wrap.type == "branch" + def test_parse_nested_branch(self): + wrap = StreamWrapper( + "https://testing.speckle.dev/streams/4c3ce1459c/branches/izzy/dev" + ) + + assert wrap.branch_name == "izzy/dev" + assert wrap.type == "branch" + def test_parse_commit(self): wrap = StreamWrapper( "https://testing.speckle.dev/streams/4c3ce1459c/commits/8b9b831792"