Fix an issue with invalid drive before migration

pull/1/head
yflory 8 years ago
parent 728272d936
commit fb388f2610

@ -889,6 +889,13 @@ define([
element[key] = id;
delete element[el];
}
if (typeof element[el] === "number") {
var data = files[FILES_DATA][element[el]];
if (!data) {
debug("An element in ROOT doesn't have associated data", element[el], el);
delete element[el];
}
}
}
};
var fixTrashRoot = function () {
@ -906,6 +913,14 @@ define([
obj.element = id;
}
if (isFolder(obj.element)) { fixRoot(obj.element); }
if (typeof obj.element === "number") {
var data = files[FILES_DATA][obj.element];
if (!data) {
debug("An element in TRASH doesn't have associated data", obj.element, el);
delete element[el];
}
}
};
for (var el in tr) {
if (!Array.isArray(tr[el])) {
@ -943,6 +958,13 @@ define([
files[FILES_DATA][id] = {href: el};
us[idx] = id;
}
if (typeof el === "number") {
var data = files[FILES_DATA][el];
if (!data) {
debug("An element in TEMPLATE doesn't have associated data", el);
delete element[el];
}
}
});
toClean.forEach(function (idx) {
us.splice(idx, 1);

@ -1569,7 +1569,7 @@ define([
if (prop === 'atime' || prop === 'ctime') {
return new Date(data[prop]);
}
return filesOp.getTitle(id).toLowerCase();
return (filesOp.getTitle(id) || "").toLowerCase();
};
keys.sort(function(a, b) {
if (getProp(a, prop) < getProp(b, prop)) { return mult * -1; }
@ -1605,7 +1605,7 @@ define([
return new Date(e[prop]);
}
}
return el.name.toLowerCase();
return (el.name || "").toLowerCase();
};
keys.sort(function(a, b) {
if (getProp(a, prop) < getProp(b, prop)) { return mult * -1; }

Loading…
Cancel
Save