From ddbda08c882aa7e5570c2278aef8d631822f632e Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 12 Sep 2017 11:29:24 +0200 Subject: [PATCH] Fix an issue when cleaning the template category in the drive --- www/common/userObject.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/www/common/userObject.js b/www/common/userObject.js index dc3b9652f..f93bb83c1 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -1016,7 +1016,7 @@ define([ var toClean = []; us.forEach(function (el, idx) { if (!isFile(el, true) || rootFiles.indexOf(el) !== -1) { - toClean.push(idx); + toClean.push(el); } if (typeof el === "string") { // We have an old file (href) which is not in filesData: add it @@ -1028,12 +1028,15 @@ define([ var data = files[FILES_DATA][el]; if (!data) { debug("An element in TEMPLATE doesn't have associated data", el); - toClean.push(idx); + toClean.push(el); } } }); - toClean.forEach(function (idx) { - us.splice(idx, 1); + toClean.forEach(function (el) { + var idx = us.indexOf(el); + if (idx !== -1) { + us.splice(idx, 1); + } }); }; var migrateAttributes = function (el, id, parsed) {