diff options
author | 2017-02-20 19:09:11 -0800 | |
---|---|---|
committer | 2017-02-20 19:18:51 -0800 | |
commit | c91509d823c27fdb1527c61f77c959b305170915 (patch) | |
tree | 897431777e0fc0e532a3976cdc614bdc3120cd05 | |
parent | deeptime: cancel alarm signal before handling socket.error (bug 523312) (diff) | |
download | mirrorselect-c91509d823c27fdb1527c61f77c959b305170915.tar.gz mirrorselect-c91509d823c27fdb1527c61f77c959b305170915.tar.bz2 mirrorselect-c91509d823c27fdb1527c61f77c959b305170915.zip |
main.py: Fix Bytes error in hosts list bug 610016
The code was only checking the first host which was not a bytes instance
in that case. This resulted in the remaining host entries to not be decoded.
Signed-off-by: Brian Dolbec <dolsen@gentoo.org>
-rwxr-xr-x | mirrorselect/main.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mirrorselect/main.py b/mirrorselect/main.py index d17a4f1..30345cc 100755 --- a/mirrorselect/main.py +++ b/mirrorselect/main.py @@ -108,8 +108,9 @@ class MirrorSelect(object): else: var = 'GENTOO_MIRRORS' - if hasattr(hosts[0], 'decode'): - hosts = [x.decode('utf-8') for x in hosts] + for i in range(0, len(hosts)): + if isinstance(hosts[i], 'bytes'): + hosts[i] = hosts[i].decode('utf-8') if var == "sync-uri" and out: mirror_string = '%s = %s' % (var, ' '.join(hosts)) |