Fix infinite loop when trying to display an invalid category in the drive

pull/1/head
yflory 6 years ago
parent 16477bd15b
commit 26ef1e5769

@ -2697,25 +2697,29 @@ define([
// NOTE: Elements in the trash are not using the same storage structure as the others // NOTE: Elements in the trash are not using the same storage structure as the others
var _displayDirectory = function (path, force) { var _displayDirectory = function (path, force) {
APP.hideMenu(); APP.hideMenu();
if (!APP.editable) { debug("Read-only mode"); } if (!APP.editable) { debug("Read-only mode"); }
if (!appStatus.isReady && !force) { return; } if (!appStatus.isReady && !force) { return; }
// Only Trash and Root are available in not-owned files manager if (!path || path.length === 0) {
if (!path || displayedCategories.indexOf(path[0]) === -1) { // Only Trash and Root are available in not-owned files manager
log(Messages.fm_categoryError); if (!path || displayedCategories.indexOf(path[0]) === -1) {
currentPath = [ROOT]; log(Messages.fm_categoryError);
_displayDirectory(currentPath); }
return; if (!APP.loggedIn && APP.newSharedFolder) {
// ANON_SHARED_FOLDER
path = [SHARED_FOLDER, ROOT];
} else {
path = [ROOT];
}
} }
appStatus.ready(false); appStatus.ready(false);
currentPath = path; currentPath = path;
var s = $content.scrollTop() || 0; var s = $content.scrollTop() || 0;
$content.html(""); $content.html("");
sel.$selectBox = $('<div>', {'class': 'cp-app-drive-content-select-box'}) sel.$selectBox = $('<div>', {'class': 'cp-app-drive-content-select-box'})
.appendTo($content); .appendTo($content);
if (!path || path.length === 0) {
path = [ROOT];
}
var isInRoot = manager.isPathIn(path, [ROOT]); var isInRoot = manager.isPathIn(path, [ROOT]);
var inTrash = manager.isPathIn(path, [TRASH]); var inTrash = manager.isPathIn(path, [TRASH]);
var isTrashRoot = manager.comparePath(path, [TRASH]); var isTrashRoot = manager.comparePath(path, [TRASH]);
@ -2726,6 +2730,10 @@ define([
var isTags = path[0] === TAGS; var isTags = path[0] === TAGS;
// ANON_SHARED_FOLDER // ANON_SHARED_FOLDER
var isSharedFolder = path[0] === SHARED_FOLDER && APP.newSharedFolder; var isSharedFolder = path[0] === SHARED_FOLDER && APP.newSharedFolder;
if (isSharedFolder && path.length < 2) {
path = [SHARED_FOLDER, 'root'];
currentPath = path;
}
var root = isVirtual ? undefined : manager.find(path); var root = isVirtual ? undefined : manager.find(path);
if (manager.isSharedFolder(root)) { if (manager.isSharedFolder(root)) {

Loading…
Cancel
Save