fix(wrapper): fix for nested branches

This commit is contained in:
izzy lyseggen
2021-11-17 15:59:51 +00:00
parent 95012e60c1
commit 9acf2c8a92
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -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."
)
+8
View File
@@ -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"