From 371edff943c1632cd40ba7a3cd960539b40a9862 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 11 May 2017 14:24:16 +0200 Subject: [PATCH] Fix an error when moving unsorted files to root in the drive --- www/common/userObject.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/www/common/userObject.js b/www/common/userObject.js index a7c21f3f3..0972b6943 100644 --- a/www/common/userObject.js +++ b/www/common/userObject.js @@ -840,21 +840,17 @@ define([ return; } var rootFiles = getFiles([ROOT, TEMPLATE]).slice(); - //var toClean = []; var root = find([ROOT]); us.forEach(function (el) { if (!isFile(el) || rootFiles.indexOf(el) !== -1) { return; - //toClean.push(idx); } - var name = getFileData(el).title || NEW_FILE_NAME; + var data = getFileData(el); + var name = data ? data.title : NEW_FILE_NAME; var newName = getAvailableName(root, name); root[newName] = el; }); delete files[UNSORTED]; - /*toClean.forEach(function (idx) { - us.splice(idx, 1); - });*/ }; var fixTemplate = function () { if (!Array.isArray(files[TEMPLATE])) { debug("TEMPLATE was not an array"); files[TEMPLATE] = []; }