From 128383a667af80740787bba103b780cc44f8bc2e Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Tue, 24 Jul 2018 14:13:55 +0800 Subject: [PATCH 22/65] fix quoted empty string failed While password or username is a empty string, it failed to invoke quote: ... | File "/usr/lib64/python2.7/site-packages/pyanaconda/iutil.py", line 823, in parse_components | quote(self.password) or "") | File "/usr/lib64/python2.7/urllib.py", line 1290, in quote | raise TypeError('None object cannot be quoted') ... Upstream-Status: Pending Signed-off-by: Hongxu Jia --- pyanaconda/core/util.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyanaconda/core/util.py b/pyanaconda/core/util.py index 90340d9..df94f17 100644 --- a/pyanaconda/core/util.py +++ b/pyanaconda/core/util.py @@ -832,9 +832,13 @@ class ProxyString(object): def parse_components(self): """ Parse the components of a proxy url into url and noauth_url """ - if self.username or self.password: - self.proxy_auth = "%s:%s@" % (quote(self.username or ""), - quote(self.password or "")) + if self.username and self.password: + self.proxy_auth = "%s:%s@" % (quote(self.username) or "", + quote(self.password) or "") + elif self.username and not self.password: + self.proxy_auth = "%s:@" % (quote(self.username) or "") + elif not self.username and self.password: + self.proxy_auth = ":%s@" % (quote(self.password) or "") self.url = self.protocol + self.proxy_auth + self.host + ":" + self.port self.noauth_url = self.protocol + self.host + ":" + self.port -- 2.7.4