Skip to content

Commit 5966e49

Browse files
committed
Fix is_for_repo
1 parent 476e397 commit 5966e49

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/git_autograder/remote.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ def is_for_repo(self, owner: str, repo_name: str) -> bool:
3333
path_parts = parsed.path.strip("/").split("/")
3434
elif remote_url.startswith("[email protected]"):
3535
# [email protected]:<owner>/<repo>.git
36-
path_parts = remote_url.split(":")[1].split("/")
36+
components = remote_url.split(":")
37+
if len(components) != 2:
38+
return False
39+
path_parts = components[1].split("/")
3740
else:
3841
return False
3942

4043
owner_part, repo_part = path_parts
4144
if repo_part.endswith(".git"):
42-
repo_part = repo_part[:-1]
45+
repo_part = repo_part[:-4]
4346

4447
return owner_part == owner and repo_part == repo_name

0 commit comments

Comments
 (0)