diff --git a/www/file/fileObject.js b/www/file/fileObject.js index df1f80169..1f98171c9 100644 --- a/www/file/fileObject.js +++ b/www/file/fileObject.js @@ -596,13 +596,16 @@ define([ var rootFiles = getRootFiles(); var trashFiles = getTrashFiles(); var templateFiles = getTemplateFiles(); + var newPath, parentEl; if (path && isPathInHrefArray(path)) { - var parentEl = findElement(files, newPath); + newPath = decodeURIComponent(path).split(','); + parentEl = findElement(files, newPath); parentEl.push(href); + return; } - else if (path && name) { - var newPath = decodeURIComponent(path).split(','); - var parentEl = findElement(files, newPath); + if (path && name) { + newPath = decodeURIComponent(path).split(','); + parentEl = findElement(files, newPath); if (parentEl) { var newName = getAvailableName(parentEl, name); parentEl[newName] = href; @@ -621,7 +624,7 @@ define([ var href = fileData.href; var test = files[FILES_DATA].some(function (o) { - o.href === href; + return o.href === href; }); if (!test) { files[FILES_DATA].push(fileData); diff --git a/www/file/main.js b/www/file/main.js index 49a9a4598..424c056b5 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -18,7 +18,7 @@ define([ var $iframe = $('#pad-iframe').contents(); var ifrw = $('#pad-iframe')[0].contentWindow; - //Cryptpad.addLoadingScreen(); + Cryptpad.addLoadingScreen(); var onConnectError = function (info) { Cryptpad.errorLoadingScreen(Messages.websocketError); }; @@ -956,7 +956,9 @@ define([ var $fileHeader = getFileListHeader(false); $container.append($fileHeader); var keys = unsorted; - var sortedFiles = sortElements(false, [rootName], keys, Cryptpad.getLSAttribute(SORT_FILE_BY), !getSortFileDesc(), true); + var sortBy = Cryptpad.getLSAttribute(SORT_FILE_BY); + sortBy = sortBy === "" ? sortBy = 'title' : sortBy; + var sortedFiles = sortElements(false, [rootName], keys, sortBy, !getSortFileDesc(), true); sortedFiles.forEach(function (href) { var file = filesOp.getFileData(href); if (!file) {