Fix invalid file ID in the drive

pull/1/head
yflory 6 years ago
parent bd190dc73b
commit f5858f524d

@ -626,6 +626,11 @@ define([
var toClean = [];
for (var id in fd) {
id = Number(id);
if (!id && id !== 0) {
debug("Invalid file ID in filesData.", id);
toClean.push(id);
continue;
}
var el = fd[id];
// Clean corrupted data

@ -729,6 +729,7 @@ define([
if (type === "pin") {
return function (fileId) {
var data = userObject.getFileData(fileId);
if (!data) { return; }
// Don't pin pads owned by someone else
if (_ownedByOther(Env, data.owners)) { return; }
// Don't push duplicates

@ -311,12 +311,12 @@ define([
_getFiles[FILES_DATA] = function () {
var ret = [];
if (!files[FILES_DATA]) { return ret; }
return Object.keys(files[FILES_DATA]).map(Number);
return Object.keys(files[FILES_DATA]).map(Number).filter(Boolean);
};
_getFiles[SHARED_FOLDERS] = function () {
var ret = [];
if (!files[SHARED_FOLDERS]) { return ret; }
return Object.keys(files[SHARED_FOLDERS]).map(Number);
return Object.keys(files[SHARED_FOLDERS]).map(Number).filter(Boolean);
};
var getFiles = exp.getFiles = function (categories) {
var ret = [];

Loading…
Cancel
Save