|
|
@ -109,24 +109,27 @@ define([
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
fo.fixFiles();
|
|
|
|
var todo = function () {
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
fo.fixFiles();
|
|
|
|
console.log("DRIVE1: migration from RECENTPADS to filesData failed");
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
return cb();
|
|
|
|
console.log("DRIVE1: migration from RECENTPADS to filesData failed");
|
|
|
|
}
|
|
|
|
return cb();
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
}
|
|
|
|
if (!fileKey) { return cb(); }
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
if (!fileKey) { return cb(); }
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
&& typeof files.trash.DeletedF[1].element === "number"
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.filesData[files.trash.DeletedF[1].element] === "object"
|
|
|
|
&& typeof files.trash.DeletedF[1].element === "number"
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].filename === "DeletedF"
|
|
|
|
&& typeof files.filesData[files.trash.DeletedF[1].element] === "object"
|
|
|
|
&& typeof files.template[0] === "number"
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].filename === "DeletedF"
|
|
|
|
&& typeof files.filesData[files.template[0]] === "object"
|
|
|
|
&& typeof files.template[0] === "number"
|
|
|
|
&& !files.filesData[files.template[0]].filename;
|
|
|
|
&& typeof files.filesData[files.template[0]] === "object"
|
|
|
|
return cb(res);
|
|
|
|
&& !files.filesData[files.template[0]].filename;
|
|
|
|
|
|
|
|
return cb(res);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
fo.migrate(todo);
|
|
|
|
}, "DRIVE1: migration and fixFiles without unsorted");
|
|
|
|
}, "DRIVE1: migration and fixFiles without unsorted");
|
|
|
|
|
|
|
|
|
|
|
|
assert(function (cb) {
|
|
|
|
assert(function (cb) {
|
|
|
@ -153,33 +156,36 @@ define([
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
fo.fixFiles();
|
|
|
|
var todo = function () {
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
fo.fixFiles();
|
|
|
|
console.log("DRIVE2: migration from RECENTPADS to filesData failed");
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
return cb();
|
|
|
|
console.log("DRIVE2: migration from RECENTPADS to filesData failed");
|
|
|
|
}
|
|
|
|
return cb();
|
|
|
|
if (!files.template) {
|
|
|
|
}
|
|
|
|
console.log("DRIVE2: template is missing");
|
|
|
|
if (!files.template) {
|
|
|
|
return cb();
|
|
|
|
console.log("DRIVE2: template is missing");
|
|
|
|
}
|
|
|
|
return cb();
|
|
|
|
if (files.unsorted) {
|
|
|
|
}
|
|
|
|
console.log("DRIVE2: unsorted not removed");
|
|
|
|
if (files.unsorted) {
|
|
|
|
return cb();
|
|
|
|
console.log("DRIVE2: unsorted not removed");
|
|
|
|
}
|
|
|
|
return cb();
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
}
|
|
|
|
var fileKey2 = Object.keys(files.root).filter(function (x) {
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
return typeof files.root[x] === "number";
|
|
|
|
var fileKey2 = Object.keys(files.root).filter(function (x) {
|
|
|
|
})[0];
|
|
|
|
return typeof files.root[x] === "number";
|
|
|
|
if (!fileKey || !fileKey2) { return cb(); }
|
|
|
|
})[0];
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
if (!fileKey || !fileKey2) { return cb(); }
|
|
|
|
var fileId2 = files.root[fileKey2];
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
var fileId2 = files.root[fileKey2];
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
&& typeof fileId2 === "number"
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.filesData[fileId2] === "object"
|
|
|
|
&& typeof fileId2 === "number"
|
|
|
|
&& !files.filesData[fileId2].filename;
|
|
|
|
&& typeof files.filesData[fileId2] === "object"
|
|
|
|
return cb(res);
|
|
|
|
&& !files.filesData[fileId2].filename;
|
|
|
|
|
|
|
|
return cb(res);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
fo.migrate(todo);
|
|
|
|
}, "DRIVE2: migration and fixFiles with unsorted");
|
|
|
|
}, "DRIVE2: migration and fixFiles with unsorted");
|
|
|
|
|
|
|
|
|
|
|
|
assert(function (cb) {
|
|
|
|
assert(function (cb) {
|
|
|
@ -204,33 +210,36 @@ define([
|
|
|
|
"CryptPad_RECENTPADS": []
|
|
|
|
"CryptPad_RECENTPADS": []
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
var fo = FO.init(files, config);
|
|
|
|
fo.fixFiles();
|
|
|
|
var todo = function () {
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
fo.fixFiles();
|
|
|
|
console.log("DRIVE2: migration from RECENTPADS to filesData failed");
|
|
|
|
if (files['CryptPad_RECENTPADS'] || !files.filesData) {
|
|
|
|
return cb();
|
|
|
|
console.log("DRIVE2: migration from RECENTPADS to filesData failed");
|
|
|
|
}
|
|
|
|
return cb();
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
}
|
|
|
|
var fileKey2 = Object.keys(files.trash.DeletedF[0].element)[0];
|
|
|
|
var fileKey = Object.keys(files.root.Folder2)[0];
|
|
|
|
if (!fileKey || !fileKey2) { return cb(); }
|
|
|
|
var fileKey2 = Object.keys(files.trash.DeletedF[0].element)[0];
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
if (!fileKey || !fileKey2) { return cb(); }
|
|
|
|
var fileId2 = files.trash.DeletedF[0].element[fileKey2];
|
|
|
|
var fileId = files.root.Folder2[fileKey];
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
var fileId2 = files.trash.DeletedF[0].element[fileKey2];
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
var res = typeof fileId === "number"
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.filesData[fileId] === "object"
|
|
|
|
&& files.filesData[fileId].href === href1
|
|
|
|
&& files.filesData[fileId].filename === "FileName"
|
|
|
|
&& typeof files.trash.DeletedF[1].element === "number"
|
|
|
|
&& files.filesData[fileId].href === href1
|
|
|
|
&& typeof files.filesData[files.trash.DeletedF[1].element] === "object"
|
|
|
|
&& typeof files.trash.DeletedF[1].element === "number"
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].filename === "DeletedF"
|
|
|
|
&& typeof files.filesData[files.trash.DeletedF[1].element] === "object"
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].href === href2
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].filename === "DeletedF"
|
|
|
|
&& typeof files.template[0] === "number"
|
|
|
|
&& files.filesData[files.trash.DeletedF[1].element].href === href2
|
|
|
|
&& typeof files.filesData[files.template[0]] === "object"
|
|
|
|
&& typeof files.template[0] === "number"
|
|
|
|
&& !files.filesData[files.template[0]].filename
|
|
|
|
&& typeof files.filesData[files.template[0]] === "object"
|
|
|
|
&& files.filesData[files.template[0]].href === href3
|
|
|
|
&& !files.filesData[files.template[0]].filename
|
|
|
|
&& typeof fileId2 === "number"
|
|
|
|
&& files.filesData[files.template[0]].href === href3
|
|
|
|
&& typeof files.filesData[fileId2] === "object"
|
|
|
|
&& typeof fileId2 === "number"
|
|
|
|
&& files.filesData[fileId2].filename === "Trash"
|
|
|
|
&& typeof files.filesData[fileId2] === "object"
|
|
|
|
&& files.filesData[fileId2].href === href4;
|
|
|
|
&& files.filesData[fileId2].filename === "Trash"
|
|
|
|
return cb(res);
|
|
|
|
&& files.filesData[fileId2].href === href4;
|
|
|
|
|
|
|
|
return cb(res);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
fo.migrate(todo);
|
|
|
|
}, "DRIVE4: migration and fixFiles with a pad in trash not root");
|
|
|
|
}, "DRIVE4: migration and fixFiles with a pad in trash not root");
|
|
|
|
|
|
|
|
|
|
|
|
// userObject Tests
|
|
|
|
// userObject Tests
|
|
|
|