From c91509d823c27fdb1527c61f77c959b305170915 Mon Sep 17 00:00:00 2001 From: zakalwe Date: Mon, 20 Feb 2017 19:09:11 -0800 Subject: 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 --- mirrorselect/main.py | 5 +++-- 1 file 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)) -- cgit v1.2.3-65-gdbad