summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorChristopher Larson <kergoth@gmail.com>2012-05-21 16:34:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-22 14:56:16 +0100
commit532f96ddcc2e3641db25b08d4ca93ce4d196a984 (patch)
tree2ce79df367143b7e32a1574196487639d4297ec8 /bitbake/lib/bb/fetch2/__init__.py
parent5c880fb3018629c00783a9869bc48685d23b58b8 (diff)
downloadpoky-532f96ddcc2e3641db25b08d4ca93ce4d196a984.tar.gz
fetch2: quote/unquote url paths
This ensures we can handle things like %-encoded characters in the path portion of urls. (Bitbake rev: b1dbc24ebcc4e5100c32568c2c41fd982fb4bcce) Signed-off-by: Christopher Larson <kergoth@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 6cd389a296..0b976c4079 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -28,6 +28,7 @@ from __future__ import absolute_import
28from __future__ import print_function 28from __future__ import print_function
29import os, re 29import os, re
30import logging 30import logging
31import urllib
31import bb.persist_data, bb.utils 32import bb.persist_data, bb.utils
32from bb import data 33from bb import data
33 34
@@ -147,14 +148,14 @@ def decodeurl(url):
147 s1, s2 = s.split('=') 148 s1, s2 = s.split('=')
148 p[s1] = s2 149 p[s1] = s2
149 150
150 return (type, host, path, user, pswd, p) 151 return type, host, urllib.unquote(path), user, pswd, p
151 152
152def encodeurl(decoded): 153def encodeurl(decoded):
153 """Encodes a URL from tokens (scheme, network location, path, 154 """Encodes a URL from tokens (scheme, network location, path,
154 user, password, parameters). 155 user, password, parameters).
155 """ 156 """
156 157
157 (type, host, path, user, pswd, p) = decoded 158 type, host, path, user, pswd, p = decoded
158 159
159 if not path: 160 if not path:
160 raise MissingParameterError('path', "encoded from the data %s" % str(decoded)) 161 raise MissingParameterError('path', "encoded from the data %s" % str(decoded))
@@ -168,7 +169,7 @@ def encodeurl(decoded):
168 url += "@" 169 url += "@"
169 if host and type != "file": 170 if host and type != "file":
170 url += "%s" % host 171 url += "%s" % host
171 url += "%s" % path 172 url += "%s" % urllib.quote(path)
172 if p: 173 if p:
173 for parm in p: 174 for parm in p:
174 url += ";%s=%s" % (parm, p[parm]) 175 url += ";%s=%s" % (parm, p[parm])