Skip to content

Commit

Permalink
Improved compatibility of serializer tests with Python 3 log2timeline…
Browse files Browse the repository at this point in the history
  • Loading branch information
Onager authored and joachimmetz committed Jun 12, 2018
1 parent e8f0df9 commit a563c24
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plaso/serializer/json_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import unicode_literals

import binascii
import codecs
import collections
import json

Expand Down Expand Up @@ -81,9 +82,11 @@ def _ConvertAttributeValueToDict(cls, attribute_value):
* a list.
"""
if isinstance(attribute_value, py2to3.BYTES_TYPE):
encoded_value = binascii.b2a_qp(attribute_value)
encoded_value = codecs.decode(encoded_value, 'ascii')
attribute_value = {
'__type__': 'bytes',
'stream': '{0:s}'.format(binascii.b2a_qp(attribute_value))
'stream': '{0:s}'.format(encoded_value)
}

elif isinstance(attribute_value, (list, tuple)):
Expand Down

0 comments on commit a563c24

Please sign in to comment.