summaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
authorAndrew Lamoureux <andrew@vector35.com>2019-03-22 01:54:26 -0400
committerAndrew Lamoureux <andrew@vector35.com>2019-03-22 01:54:26 -0400
commitc5912d01b4c7c2776337740221068f37c1dfe877 (patch)
tree680a6b0f0f35e271c9b853de2643d92eadb09676 /python/examples
parentbb13d08b8ae39998db6c87108f3983a72f034143 (diff)
kaitai: don't store file contents in tree!! clamp at 8
Diffstat (limited to 'python/examples')
-rw-r--r--python/examples/kaitai/kshelpers.py9
1 files changed, 5 insertions, 4 deletions
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):