Fix parsing of URLs with port numbers
This commit is contained in:
parent
6444cf144b
commit
9bc9680285
2 changed files with 15 additions and 1 deletions
|
|
@ -301,7 +301,7 @@ class SCM(object):
|
||||||
if password is not None and not allow_password:
|
if password is not None and not allow_password:
|
||||||
raise koji.GenericError('username:password format not supported: %s:%s'
|
raise koji.GenericError('username:password format not supported: %s:%s'
|
||||||
% (user, password))
|
% (user, password))
|
||||||
netloc = parsed_url.hostname
|
netloc = userhost[-1]
|
||||||
|
|
||||||
# check for empty path before we apply normpath
|
# check for empty path before we apply normpath
|
||||||
if not path:
|
if not path:
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ class TestSCM(unittest.TestCase):
|
||||||
"svn+ssh://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
"svn+ssh://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
||||||
"cvs://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
"cvs://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
||||||
"cvs+ssh://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
"cvs+ssh://server/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
||||||
|
"cvs+ssh://server:80/some/path#bab0c73900241ef5c465d7e873e9d8b34c948e67",
|
||||||
]
|
]
|
||||||
bad = [
|
bad = [
|
||||||
"http://localhost/foo.html",
|
"http://localhost/foo.html",
|
||||||
|
|
@ -98,6 +99,19 @@ class TestSCM(unittest.TestCase):
|
||||||
self.assertEqual(scm.source_cmd, ['make', 'sources'])
|
self.assertEqual(scm.source_cmd, ['make', 'sources'])
|
||||||
self.assertEqual(scm.scmtype, 'GIT')
|
self.assertEqual(scm.scmtype, 'GIT')
|
||||||
|
|
||||||
|
def test_with_port(self):
|
||||||
|
url = "git+ssh://user@server:80/foo.git#bab0c73900241ef5c465d7e873e9d8b34c948e67"
|
||||||
|
scm = SCM(url)
|
||||||
|
self.assertEqual(scm.scheme, 'git+ssh://')
|
||||||
|
self.assertEqual(scm.user, 'user')
|
||||||
|
self.assertEqual(scm.host, 'server:80')
|
||||||
|
self.assertEqual(scm.repository, '/foo.git')
|
||||||
|
self.assertEqual(scm.module, '')
|
||||||
|
self.assertEqual(scm.revision, 'bab0c73900241ef5c465d7e873e9d8b34c948e67')
|
||||||
|
self.assertEqual(scm.use_common, True)
|
||||||
|
self.assertEqual(scm.source_cmd, ['make', 'sources'])
|
||||||
|
self.assertEqual(scm.scmtype, 'GIT+SSH')
|
||||||
|
|
||||||
def test_assert_allowed_basic(self):
|
def test_assert_allowed_basic(self):
|
||||||
scm = SCM("git://scm.example.com/path1#1234")
|
scm = SCM("git://scm.example.com/path1#1234")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue