mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
5c880fb301
commit
532f96ddcc
@@ -28,6 +28,7 @@ from __future__ import absolute_import
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os, re
|
import os, re
|
||||||
import logging
|
import logging
|
||||||
|
import urllib
|
||||||
import bb.persist_data, bb.utils
|
import bb.persist_data, bb.utils
|
||||||
from bb import data
|
from bb import data
|
||||||
|
|
||||||
@@ -147,14 +148,14 @@ def decodeurl(url):
|
|||||||
s1, s2 = s.split('=')
|
s1, s2 = s.split('=')
|
||||||
p[s1] = s2
|
p[s1] = s2
|
||||||
|
|
||||||
return (type, host, path, user, pswd, p)
|
return type, host, urllib.unquote(path), user, pswd, p
|
||||||
|
|
||||||
def encodeurl(decoded):
|
def encodeurl(decoded):
|
||||||
"""Encodes a URL from tokens (scheme, network location, path,
|
"""Encodes a URL from tokens (scheme, network location, path,
|
||||||
user, password, parameters).
|
user, password, parameters).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
(type, host, path, user, pswd, p) = decoded
|
type, host, path, user, pswd, p = decoded
|
||||||
|
|
||||||
if not path:
|
if not path:
|
||||||
raise MissingParameterError('path', "encoded from the data %s" % str(decoded))
|
raise MissingParameterError('path', "encoded from the data %s" % str(decoded))
|
||||||
@@ -168,7 +169,7 @@ def encodeurl(decoded):
|
|||||||
url += "@"
|
url += "@"
|
||||||
if host and type != "file":
|
if host and type != "file":
|
||||||
url += "%s" % host
|
url += "%s" % host
|
||||||
url += "%s" % path
|
url += "%s" % urllib.quote(path)
|
||||||
if p:
|
if p:
|
||||||
for parm in p:
|
for parm in p:
|
||||||
url += ";%s=%s" % (parm, p[parm])
|
url += ";%s=%s" % (parm, p[parm])
|
||||||
|
|||||||
Reference in New Issue
Block a user