diff --git a/www/file/file-crypto.js b/www/file/file-crypto.js index f2202c8f8..44952fc87 100644 --- a/www/file/file-crypto.js +++ b/www/file/file-crypto.js @@ -206,10 +206,14 @@ define([ var nonce = createNonce(); // encode metadata - var metaBuffer = Array.prototype.slice - .call(Nacl.util.decodeUTF8(JSON.stringify(metadata))); + var plaintext = 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; diff --git a/www/file/main.js b/www/file/main.js index 79bd70af8..ec3961196 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -91,6 +91,8 @@ define([ Title.updateTitle(title || Title.defaultTitle); toolbar.addElement(['pageTitle'], {pageTitle: title}); + console.error(metadata); + var displayFile = function (ev, sizeMb, CB) { var called_back; var cb = function (e) {