Don't store in the drive pads without a hash

pull/1/head
yflory 8 years ago
parent f329726fa4
commit 5a5b02b82b

@ -299,10 +299,14 @@ define([
pads.forEach(function (pad, i) { pads.forEach(function (pad, i) {
if (pad && typeof(pad) === 'object') { if (pad && typeof(pad) === 'object') {
var hash = checkObjectData(pad); var hash = checkObjectData(pad);
if (!hash || !common.parseHash(hash)) { return; } if (!hash || !common.parseHash(hash)) {
console.error("[Cryptpad.checkRecentPads] pad had unexpected value", pad);
getStore().removeData(i);
return;
}
return pad; return pad;
} }
console.error("[Cryptpad.migrateRecentPads] pad had unexpected value"); console.error("[Cryptpad.checkRecentPads] pad had unexpected value", pad);
getStore().removeData(i); getStore().removeData(i);
}); });
}; };
@ -571,7 +575,7 @@ define([
return pad; return pad;
}); });
if (!contains) { if (!contains && href) {
var data = makePad(href, name); var data = makePad(href, name);
getStore().pushData(data, function (e) { getStore().pushData(data, function (e) {
if (e) { if (e) {

@ -883,6 +883,11 @@ define([
toClean.push(el); toClean.push(el);
return; return;
} }
if (!el.href) {
debug("Rmoving an element in filesData with a missing href.", el);
toClean.push(el);
return;
}
if (rootFiles.indexOf(el.href) === -1) { if (rootFiles.indexOf(el.href) === -1) {
debug("An element in filesData was not in ROOT, TEMPLATE or TRASH.", el); debug("An element in filesData was not in ROOT, TEMPLATE or TRASH.", el);
var name = el.title || NEW_FILE_NAME; var name = el.title || NEW_FILE_NAME;

Loading…
Cancel
Save