py3: base64 encoding/decoding returns always bytes don't mix it

Using unicode(bytes) call causes undesired side effect that is inserting
`b` character to result. This obviously causes issues with binary base64 data

https://fedorahosted.org/freeipa/ticket/4985

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
Martin Basti
2017-01-24 17:49:06 +01:00
committed by Jan Cholasta
parent 8e139d4b55
commit caa560ca79
4 changed files with 7 additions and 7 deletions

View File

@@ -1036,7 +1036,7 @@ last, after all sets and adds."""),
except ValueError:
if isinstance(delval, bytes):
# This is a Binary value, base64 encode it
delval = unicode(base64.b64encode(delval))
delval = base64.b64encode(delval).decode('ascii')
raise errors.AttrValueNotFound(attr=attr, value=delval)
# normalize all values