Comment 21 for bug 1799746

Revision history for this message
James Page (james-page) wrote : Re: PY3: when uploading file as secret: TypeError: a bytes-like object is required, not 'str'

The code incorrectly assumes that base64 is byte encoded so something like:

        elif content_encoding.lower() == 'base64':
            if not isinstance(unencrypted, six.binary_type):
                b64payload = unencrypted.encode('utf-8')
            else:
                b64payload = unencrypted

does the trick in terms of ensuring binary encoding of the data in this code path.