diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js
index b0d6ea424..f511b5c5e 100644
--- a/www/common/cryptpad-common.js
+++ b/www/common/cryptpad-common.js
@@ -1198,8 +1198,39 @@ define([
var decrypted = e.originalEvent;
if (decrypted.callback) {
var cb = decrypted.callback;
- decrypted.callback = undefined;
- cb();
+ cb(function (mediaObject) {
+ if (mediaObject.type !== 'download') { return; }
+ var root = mediaObject.rootElement;
+ if (!root) { return; }
+
+ var metadata = decrypted.metadata;
+
+ var title = '';
+ var size = 0;
+ if (metadata && metadata.name) {
+ title = metadata.name;
+ }
+
+ if (decrypted.blob) {
+ size = decrypted.blob.size
+ }
+
+ var sizeMb = Cryptpad.bytesToMegabytes(size);
+
+ var $btn = $(root).find('button');
+ $btn.addClass('btn btn-primary btn-success')
+ .attr('type', 'download')
+ .html(function (i, html) {
+ var text = Messages.download_mt_button + '
';
+ if (title) {
+ text += '' + Cryptpad.fixHTML(title) + '
';
+ }
+ if (size) {
+ text += '' + Messages._getKey('formattedMB', [sizeMb]) + '';
+ }
+ return text;
+ });
+ });
}
});
common.avatarAllowedTypes = [