11#
2- # Copyright (c) 2015 nexB Inc. and others. All rights reserved.
2+ # Copyright (c) 2017 nexB Inc. and others. All rights reserved.
33# http://nexb.com and https://github.com/nexB/scancode-toolkit/
44# The ScanCode software is licensed under the Apache License version 2.0.
55# Data generated with ScanCode require an acknowledgment.
@@ -75,8 +75,12 @@ def parse_repo_url(repo_url):
7575 return repo_url
7676
7777 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 ('/' )
8084 if any (h in host for h in ['github' , 'bitbucket' , 'gitlab' ]):
8185 return 'https://%(host)s/%(repo)s' % locals ()
8286 else :
@@ -89,7 +93,7 @@ def parse_repo_url(repo_url):
8993 'gitlab' : 'https://gitlab.com/%(repo)s' ,
9094 'gist' : 'https://gist.github.com/%(repo)s' ,
9195 }
92- hoster , repo = repo_url .split (':' , 1 )
96+ hoster , _ , repo = repo_url .partition (':' )
9397 return hoster_urls [hoster ] % locals ()
9498 elif len (repo_url .split ('/' )) == 2 :
9599 # implicit github
0 commit comments