1
1
#
2
- # Copyright (c) 2015 nexB Inc. and others. All rights reserved.
2
+ # Copyright (c) 2017 nexB Inc. and others. All rights reserved.
3
3
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
4
4
# The ScanCode software is licensed under the Apache License version 2.0.
5
5
# Data generated with ScanCode require an acknowledgment.
@@ -75,8 +75,12 @@ def parse_repo_url(repo_url):
75
75
return repo_url
76
76
77
77
if repo_url .startswith ('git@' ):
78
- left , right = repo_url .split ('@' , 1 )
79
- host , repo = right .split (':' , 1 )
78
+ left , _ , right = repo_url .partition ('@' )
79
+ if ':' in repo_url :
80
+ host , _ , repo = right .partition (':' )
81
+ else :
82
+ # [email protected] /Filirom1/npm2aur.git
83
+ host , _ , repo = right .partition ('/' )
80
84
if any (h in host for h in ['github' , 'bitbucket' , 'gitlab' ]):
81
85
return 'https://%(host)s/%(repo)s' % locals ()
82
86
else :
@@ -89,7 +93,7 @@ def parse_repo_url(repo_url):
89
93
'gitlab' : 'https://gitlab.com/%(repo)s' ,
90
94
'gist' : 'https://gist.github.com/%(repo)s' ,
91
95
}
92
- hoster , repo = repo_url .split (':' , 1 )
96
+ hoster , _ , repo = repo_url .partition (':' )
93
97
return hoster_urls [hoster ] % locals ()
94
98
elif len (repo_url .split ('/' )) == 2 :
95
99
# implicit github
0 commit comments