|
|
@ -563,34 +563,41 @@ define([
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Clean missing href
|
|
|
|
// Clean missing href
|
|
|
|
if (!el.href) {
|
|
|
|
var parsed;
|
|
|
|
debug("Removing an element in filesData with a missing href.", el);
|
|
|
|
if (el.href) {
|
|
|
|
toClean.push(id);
|
|
|
|
if (!el.href) {
|
|
|
|
continue;
|
|
|
|
debug("Removing an element in filesData with a missing href.", el);
|
|
|
|
}
|
|
|
|
toClean.push(id);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var parsed = Hash.parsePadUrl(el.href);
|
|
|
|
parsed = Hash.parsePadUrl(el.href);
|
|
|
|
// Clean invalid hash
|
|
|
|
// Clean invalid hash
|
|
|
|
if (!parsed.hash) {
|
|
|
|
if (!parsed.hash) {
|
|
|
|
debug("Removing an element in filesData with a invalid href.", el);
|
|
|
|
debug("Removing an element in filesData with a invalid href.", el);
|
|
|
|
toClean.push(id);
|
|
|
|
toClean.push(id);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Clean invalid type
|
|
|
|
// Clean invalid type
|
|
|
|
if (!parsed.type) {
|
|
|
|
if (!parsed.type) {
|
|
|
|
debug("Removing an element in filesData with a invalid type.", el);
|
|
|
|
debug("Removing an element in filesData with a invalid type.", el);
|
|
|
|
|
|
|
|
toClean.push(id);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if (!el.roHref) {
|
|
|
|
|
|
|
|
debug("Removing an element in filesData with a missing href.", el);
|
|
|
|
toClean.push(id);
|
|
|
|
toClean.push(id);
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Fix href
|
|
|
|
// Fix href
|
|
|
|
if (/^https*:\/\//.test(el.href)) { el.href = Hash.getRelativeHref(el.href); }
|
|
|
|
if (el.href && /^https*:\/\//.test(el.href)) { el.href = Hash.getRelativeHref(el.href); }
|
|
|
|
// Fix creation time
|
|
|
|
// Fix creation time
|
|
|
|
if (!el.ctime) { el.ctime = el.atime; }
|
|
|
|
if (!el.ctime) { el.ctime = el.atime; }
|
|
|
|
// Fix title
|
|
|
|
// Fix title
|
|
|
|
if (!el.title) { el.title = Hash.getDefaultName(parsed); }
|
|
|
|
if (!el.title) { el.title = Hash.getDefaultName(parsed); }
|
|
|
|
// Fix channel
|
|
|
|
// Fix channel
|
|
|
|
if (!el.channel) {
|
|
|
|
if (el.href && !el.channel) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var secret = Hash.getSecrets(parsed.type, parsed.hash, el.password);
|
|
|
|
var secret = Hash.getSecrets(parsed.type, parsed.hash, el.password);
|
|
|
|
el.channel = secret.channel;
|
|
|
|
el.channel = secret.channel;
|
|
|
|