Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcard: Base64 encoding breaks if object is binary: AttributeError: 'bytes' object has no attribute 'encode' #47

Closed
pbiering opened this issue Oct 16, 2016 · 1 comment

Comments

@pbiering
Copy link
Contributor

vcard base64 encoding is broken

PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZ...
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 255, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/lib/python3.4/site-packages/vobject/behavior.py", line 162, in serialize
    out = base.defaultSerialize(transformed, buf, lineLength)
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 993, in defaultSerialize
    child.serialize(outbuf, lineLength, validate=False)
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 255, in serialize
    return behavior.serialize(self, buf, lineLength, validate)
  File "/usr/lib/python3.4/site-packages/vobject/vcard.py", line 227, in serialize
    VCardTextBehavior.serialize(obj, buf, lineLength, validate)
  File "/usr/lib/python3.4/site-packages/vobject/behavior.py", line 162, in serialize
    out = base.defaultSerialize(transformed, buf, lineLength)
  File "/usr/lib/python3.4/site-packages/vobject/base.py", line 1001, in defaultSerialize
    obj.behavior.encode(obj)
  File "/usr/lib/python3.4/site-packages/vobject/vcard.py", line 152, in encode
    line.value = codecs.encode(line.value.encode(coding), "base64").decode("utf-8")
AttributeError: 'bytes' object has no attribute 'encode'
@wpercy
Copy link
Contributor

wpercy commented Dec 6, 2016

resolved by #49

@wpercy wpercy closed this as completed Dec 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants