From d555baf508de71a5e3dc9a9aed2c13f6f202956d Mon Sep 17 00:00:00 2001 From: Russ Garrett Date: Fri, 3 May 2019 17:44:48 +0100 Subject: [PATCH] Suppress rendering of binary data - thanks @russss (#442) Binary columns (including spatialite geographies) get shown as ugly binary strings in the HTML by default. Nobody wants to see that mess. Show the size of the column in bytes instead. If you want to decode the binary data, you can use a plugin to do it. --- datasette/views/table.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/datasette/views/table.py b/datasette/views/table.py index 79b9a1b9..79af60c0 100644 --- a/datasette/views/table.py +++ b/datasette/views/table.py @@ -120,6 +120,8 @@ class RowTableShared(BaseView): ) if plugin_display_value is not None: display_value = plugin_display_value + elif isinstance(value, bytes): + display_value = jinja2.Markup("<{} bytes>".format(len(value))) elif isinstance(value, dict): # It's an expanded foreign key - display link to other row label = value["label"]