aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-installer/anaconda/files/0022-fix-quoted-empty-string-failed.patch
blob: f6a8400202f76a5f56821f61bbac356328d8f10b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 128383a667af80740787bba103b780cc44f8bc2e Mon Sep 17 00:00:00 2001
From: Hongxu Jia <hongxu.jia@windriver.com>
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 <hongxu.jia@windriver.com>

Rebase for anaconda 34.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 pyanaconda/core/payload.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/core/payload.py b/pyanaconda/core/payload.py
index 3573c6cd9..645222e82 100644
--- a/pyanaconda/core/payload.py
+++ b/pyanaconda/core/payload.py
@@ -172,9 +172,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