From bbc06f668f51c793195f562358e135b12ab4f2d9 Mon Sep 17 00:00:00 2001 From: yflory Date: Mon, 17 Dec 2018 15:49:48 +0100 Subject: [PATCH] Fix undefined hash for deleted shared folders --- www/common/outer/userObject.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/www/common/outer/userObject.js b/www/common/outer/userObject.js index a59b7c02a..58b870afb 100644 --- a/www/common/outer/userObject.js +++ b/www/common/outer/userObject.js @@ -681,8 +681,20 @@ define([ var sf = files[SHARED_FOLDERS]; var rootFiles = exp.getFiles([ROOT]); var root = exp.find([ROOT]); + var parsed, secret, el; for (var id in sf) { + el = sf[id]; id = Number(id); + + // Fix undefined hash + parsed = Hash.parsePadUrl(el.href || el.roHref); + secret = Hash.getSecrets('drive', parsed.hash, el.password); + if (!secret.keys) { + delete sf[id]; + continue; + } + + // Fix shared folder not displayed in root if (rootFiles.indexOf(id) === -1) { console.log('missing' + id); var newName = Hash.createChannelId();