[PATCH] Escape percent-signs in portage.package.ebuild.fetch.get_mirror_url()

Mike Gilbert <[email protected]>
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
This avoids double-escaping in emirrordist. We only want to escape the
path when fetching the file from the mirror, not when mirroring the
file.

Bug: https://bugs.gentoo.org/719810
Fixes: 4c18f523bb86a8be4c148f365dabee06fca2e4fa
Signed-off-by: Mike Gilbert <[email protected]>
---
 lib/portage/package/ebuild/fetch.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py
index 28e7caf53..9682fea89 100644
--- a/lib/portage/package/ebuild/fetch.py
+++ b/lib/portage/package/ebuild/fetch.py
@@ -26,6 +26,11 @@ try:
 except ImportError:
 	from urlparse import urlparse
 
+try:
+	from urllib.parse import quote as urlquote
+except ImportError:
+	from urllib import quote as urlquote
+
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
 	'portage.package.ebuild.config:check_config_instance,config',
@@ -520,7 +525,7 @@ def get_mirror_url(mirror_url, filename, mysettings, cache_path=None):
 				f.close()
 
 	return (mirror_url + "/distfiles/" +
-			mirror_conf.get_best_supported_layout().get_path(filename))
+			urlquote(mirror_conf.get_best_supported_layout().get_path(filename)))
 
 
 def fetch(myuris, mysettings, listonly=0, fetchonly=0,
-- 
2.27.0.rc2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.