drop thumbnails if metadata is too large

pull/1/head
ansuz 7 years ago
parent 4069945bc4
commit acaf45a0e0

@ -206,10 +206,14 @@ define([
var nonce = createNonce(); var nonce = createNonce();
// encode metadata // encode metadata
var metaBuffer = Array.prototype.slice var plaintext = Nacl.util.decodeUTF8(JSON.stringify(metadata));
.call(Nacl.util.decodeUTF8(JSON.stringify(metadata)));
var plaintext = new Uint8Array(metaBuffer); // if metadata is too large, drop the thumbnail.
if (plaintext.length > 65535) {
var temp = JSON.parse(JSON.stringify(metadata));
delete metadata.thumbnail;
plaintext = Nacl.util.decodeUTF8(JSON.stringify(temp));
}
var i = 0; var i = 0;

@ -91,6 +91,8 @@ define([
Title.updateTitle(title || Title.defaultTitle); Title.updateTitle(title || Title.defaultTitle);
toolbar.addElement(['pageTitle'], {pageTitle: title}); toolbar.addElement(['pageTitle'], {pageTitle: title});
console.error(metadata);
var displayFile = function (ev, sizeMb, CB) { var displayFile = function (ev, sizeMb, CB) {
var called_back; var called_back;
var cb = function (e) { var cb = function (e) {

Loading…
Cancel
Save