Link to BLOB downloads, closes #1046

This commit is contained in:
Simon Willison 2020-10-24 17:13:14 -07:00
commit 5db7ae3ce1
4 changed files with 30 additions and 4 deletions

View file

@ -167,8 +167,15 @@ class RowTableShared(DataView):
display_value = plugin_display_value
elif isinstance(value, bytes):
display_value = jinja2.Markup(
"<Binary data: {} byte{}>".format(
len(value), "" if len(value) == 1 else "s"
'<a class="blob-download" href="{}">&lt;Binary:&nbsp;{}&nbsp;byte{}&gt;</a>'.format(
self.ds.urls.row_blob(
database,
table,
path_from_row_pks(row, pks, not pks),
column,
),
len(value),
"" if len(value) == 1 else "s",
)
)
elif isinstance(value, dict):