From c5912d01b4c7c2776337740221068f37c1dfe877 Mon Sep 17 00:00:00 2001 From: Andrew Lamoureux Date: Fri, 22 Mar 2019 01:54:26 -0400 Subject: kaitai: don't store file contents in tree!! clamp at 8 --- python/examples/kaitai/kshelpers.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'python/examples') diff --git a/python/examples/kaitai/kshelpers.py b/python/examples/kaitai/kshelpers.py index a4453739..bcdc9931 100644 --- a/python/examples/kaitai/kshelpers.py +++ b/python/examples/kaitai/kshelpers.py @@ -411,10 +411,11 @@ def createLeaf(fieldName, obj): fieldValue = None - if isinstance(obj, str): - fieldValue = repr(obj) - elif isinstance(obj, bytes): - fieldValue = repr(obj) + if isinstance(obj, str) or isinstance(obj, bytes): + if len(obj) > 8: + fieldValue = str(repr(obj[0:8])) + '...' + else: + fieldValue = repr(obj) elif sys.version_info[0] == 2 and objtype == types.UnicodeType: fieldValue = repr(obj) elif isinstance(obj, int): -- cgit v1.3.1