dont break when the binhost url doesn't end with a slash (bug #144440)
authorMarius Mauch <genone@gentoo.org>
Sat, 23 Jun 2007 18:47:55 +0000 (18:47 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 23 Jun 2007 18:47:55 +0000 (18:47 -0000)
svn path=/main/trunk/; revision=6978

pym/portage/getbinpkg.py

index 410a48577af3627f7aa2e0fbcf8eeff6aa2f5c01..808eb64f952411f17354a0042ab2c7ebb5221284 100644 (file)
@@ -78,14 +78,20 @@ def create_conn(baseurl,conn=None):
        """(baseurl,conn) --- Takes a protocol://site:port/address url, and an
        optional connection. If connection is already active, it is passed on.
        baseurl is reduced to address and is returned in tuple (conn,address)"""
+
        parts = baseurl.split("://",1)
        if len(parts) != 2:
                raise ValueError, "Provided URL does not contain protocol identifier. '%s'" % baseurl
        protocol,url_parts = parts
        del parts
-       host,address = url_parts.split("/",1)
+
+       url_parts = url_parts.split("/")
+       host = url_parts[0]
+       if len(url_parts) < 2:
+               address = "/"
+       else:
+               address = "/"+"/".join(url_parts[1:])
        del url_parts
-       address = "/"+address
 
        userpass_host = host.split("@",1)
        if len(userpass_host) == 1: