summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils.py b/utils.py
index a68836f..5bea961 100644
--- a/utils.py
+++ b/utils.py
@@ -103,3 +103,6 @@ def embed_image_blob(fname, image_data):
return '<img style="max-width:100%;" src="data:{0};base64,{1}" />'.format( \
mimetype, base64.b64encode(image_data))
+def is_binary(s):
+ # Git considers a blob binary if NUL in first ~8KB, so do the same.
+ return '\0' in s[:8192]