Skip to content

Commit

Permalink
Better way implementation of the repository URL parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed Mar 26, 2024
1 parent b33adb9 commit 8832c1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dead_hosts/launcher/defaults/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@
PARSED_REMOTE_URL: str = urllib.parse.urlparse(REMOTE_URL)

if not PARSED_REMOTE_URL.netloc:
REPO_BASE = PARSED_REMOTE_URL.path.split(":", 1)[-1].replace(".git", "")
REPO_BASE = PARSED_REMOTE_URL.path.split(":", 1)[-1]
else:
REPO_BASE = PARSED_REMOTE_URL.path[1:].replace(".git", "")
REPO_BASE = PARSED_REMOTE_URL.path[1:]

if REPO_BASE.endswith(".git"):
REPO_BASE = REPO_BASE[:-4]

GIT_BASE_NAME: str = REPO_BASE.split("/", 1)[-1]
GIT_REPO_OWNER: str = REPO_BASE.split("/", 1)[0]
Expand Down

0 comments on commit 8832c1e

Please sign in to comment.