Skip to content

Commit b47a755

Browse files
committed
Fix duplicate github and gitlab tld’s
Signed-off-by: Hans van der Woude <2658411+nedix@users.noreply.github.com>
1 parent d505dc0 commit b47a755

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/go_inspector/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def repository_homepage_url(purl):
3030

3131
def get_vcs_segments(purl):
3232
nsname = get_nsname(purl)
33-
if nsname.startswith(("github", "gitlab")):
33+
if nsname.startswith(("github.com", "gitlab.com")):
3434
segments = nsname.strip("/").split("/")
3535
if len(segments) >= 3:
36-
typ = segments[0]
36+
typ, _, _ = segments[0].partition(".")
3737
ns = segments[1]
3838
nm = segments[2]
3939
return typ, ns, nm
@@ -59,8 +59,6 @@ def source_purl(purl):
5959
tnsn = get_vcs_segments(purl)
6060
if tnsn:
6161
typ, ns, nm = tnsn
62-
# strip trailing .com from github.com
63-
typ, _, _ = typ.partition(".")
6462
vrs = purl.version
6563
# only use commit for pseudo semver versions
6664
if vrs and (commit := extract_commit(vrs)):

0 commit comments

Comments
 (0)