From 499bf1ee143879885801efa5794d81eded777ae0 Mon Sep 17 00:00:00 2001 From: or-else Date: Wed, 6 Jun 2018 16:41:16 +0300 Subject: [PATCH] separate download url from preview url --- css/base.css | 2 +- drafty.js | 18 +++++++++++++++--- index.html | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/css/base.css b/css/base.css index aa71025f..0d7050cd 100644 --- a/css/base.css +++ b/css/base.css @@ -1714,7 +1714,7 @@ ul.tabbar li.active > a:after { margin: 0.35rem; width: 6rem; border-radius: 0.1rem; - background-color: silver; + background-color: #cfd8dc; } /* Colored uploader progress bar of variable length */ .uploader > div > span { diff --git a/drafty.js b/drafty.js index 5258c8db..369af8ab 100644 --- a/drafty.js +++ b/drafty.js @@ -129,7 +129,8 @@ Sample JSON representation of the text above: }, IM: { open: function(data) { - var previewUrl = data.val ? base64toObjectUrl(data.val, data.mime) : data.ref; + // Don't use data.ref for preview: it's a security risk. + var previewUrl = base64toObjectUrl(data.val, data.mime); var downloadUrl = data.ref ? data.ref : previewUrl; var res = (data.name ? '' : '') + '); }, this); content = React.createElement('span', null, Drafty.format(content, formatter, this)); @@ -3283,7 +3283,7 @@ {this.props.uploader ? : -
+
file_download save
}