commit:     c238d5f7ed264179c263f5a2da983c4ee50b4f00
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun May 31 21:24:25 2020 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun May 31 21:30:14 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c238d5f7

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

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 <floppym <AT> gentoo.org>

 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,

Reply via email to