From bd66c8fee8c67a826ced2f5c88ab17ea0fce9952 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 18 May 2018 10:28:31 +0200 Subject: [PATCH] hacks to handle weird entries in drive --- www/common/cryptpad-common.js | 2 +- www/common/outer/userObject.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 4f8f69a1b..d9fbf8acf 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -578,7 +578,7 @@ define([ } var parsed = Hash.parsePadUrl(window.location.href); if (!parsed.type || !parsed.hashData) { return void cb('E_INVALID_HREF'); } - if (parsed.type === 'file') { secret.channel = Util.base64ToHex(secret.channel); } + if (parsed.type === 'file' && typeof(parsed.channel) === 'string') { secret.channel = Util.base64ToHex(secret.channel); } hashes = Hash.getHashes(secret); if (secret.version === 0) { diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index be718562c..b24092673 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -588,6 +588,7 @@ define([ if (!el.title) { el.title = Hash.getDefaultName(parsed); } // Fix channel if (!el.channel) { + try { if (parsed.hashData && parsed.hashData.type === "file") { // PASSWORD_FILES el.channel = Util.base64ToHex(parsed.hashData.channel); @@ -596,6 +597,9 @@ define([ el.channel = secret.channel; } console.log('Adding missing channel in filesData ', el.channel); + } catch (e) { + console.error(e); + } } if ((loggedIn || config.testMode) && rootFiles.indexOf(id) === -1) {