db setup fixes

This commit is contained in:
zadam 2020-03-26 16:59:40 +01:00
parent b778985b5e
commit 2e55d544f1
5 changed files with 22 additions and 16 deletions

View File

@ -95,16 +95,17 @@ class Note extends Entity {
this.content = "";
}
}
}
if (this.isStringNote()) {
this.content = this.content === null
return this.content === null
? ""
: this.content.toString("UTF-8");
}
}
else {
return this.content;
}
}
/** @returns {Promise<*>} */
async getJsonContent() {

View File

@ -89,16 +89,17 @@ class NoteRevision extends Entity {
this.content = "";
}
}
}
if (this.isStringNote()) {
this.content = this.content === null
return this.content === null
? ""
: this.content.toString("UTF-8");
}
}
else {
return this.content;
}
}
/** @returns {Promise} */
async setContent(content) {

View File

@ -256,6 +256,10 @@ function openDialog($dialog) {
}
function isHtmlEmpty(html) {
if (!html) {
return true;
}
html = html.toLowerCase();
return $("<div>").html(html).text().trim().length === 0

View File

@ -15,7 +15,7 @@ async function getNote(req) {
}
if (note.isStringNote()) {
await note.getContent();
note.content = await note.getContent();
if (note.type === 'file') {
note.content = note.content.substr(0, 10000);

View File

@ -668,7 +668,7 @@ async function scanForLinks(note) {
await note.setContent(newContent);
}
catch (e) {
log.error(`Could not scan for links note ${noteId}: ${e.message}`);
log.error(`Could not scan for links note ${note.noteId}: ${e.message} ${e.stack}`);
}
}