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

Zac Medico <[email protected]>
Newsgroups gmane.linux.gentoo.portage.devel
Message-ID <[email protected]>
On 5/31/20 2:32 PM, Mike Gilbert wrote:
> 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,
> 

Looks good. Please merge.
-- 
Thanks,
Zac
signature.asc (application/pgp-signature, 981 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQKTBAEBCgB9FiEE8OgXaltWzqgSupCu0HX7jBBKPSAFAl7UNk9fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEYw
RTgxNzZBNUI1NkNFQTgxMkJBOTBBRUQwNzVGQjhDMTA0QTNEMjAACgkQ0HX7jBBK
PSBrgQ/+Mw4rsUqkisTUGbK6WdyhExTjR42bnUetjwYc5SnR3AUKMhmpOfPnzNZq
2844yOkoJ+7mUrGtyE4/bEH6+hY5kN5YIlD7iswfimfoI0ZtFsMkjot1WvZnhZIZ
+88e1LdyIsklfIdWg4j5HKefgKydOqyT7+5D1y5gouWkNpWg8oz/+QgCbgAWrYMC
2ulpNkAuHuXcqzD1zRpL3Si50PTFHN/5B228f2O7BXdfw02WR6ONohpP+fHSiyFw
5kHbaZhG3mVKH2pOwm/cN2TGi7ITm9U3+bNgqW5SQk1vMcepdu+tCmvMnnaHYVfK
x8OoTkXy98PEbgKxkbfzY75oM7x7GUjXVl+bEL8MubEWId0t8gyTocz1ThHDE2rt
SIEjEOL0Ozq0D1Yqlf/BDRLHJt7lJYNHAbkTeBPum2MhlkoH+81vOPoVFbF6TwzL
tIzmZ+61aaht7/qbHCxffvzlEaaY/yXyXcFZK9eWZpb+Id3cHgIU6mFo/saG1zlj
YekFVRisFJjxoUZQzxVetVWl06nPJiPPwHlWbevV+XcNdCCxVmcmxCeUyTvvQH/g
ra6TiBNbZ7WnKFunEzEc8wi9irqWY4/yxfyhZ/SLOYurGtlX1wU5Wmt9jAG0CYGW
X1d45O+HOC4VqPJJa4noSbDdiPhtNFEuX46Rpn93rx0ouHfscWk=
=yVnw
-----END PGP SIGNATURE-----
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.