split out note's content into separate entity, WIP

This commit is contained in:
zadam
2019-02-06 20:19:25 +01:00
parent 8b250ed523
commit 8884177d9f
18 changed files with 417 additions and 213 deletions

View File

@@ -12,18 +12,10 @@ async function getNote(req) {
return [404, "Note " + noteId + " has not been found."];
}
if (note.type === 'file' || note.type === 'image') {
if (note.type === 'file' && note.mime.startsWith('text/')) {
note.content = note.content.toString("UTF-8");
if (note.mime.startsWith('text/')) {
const noteContent = await note.getNoteContent();
if (note.content.length > 10000) {
note.content = note.content.substr(0, 10000) + "...";
}
}
else {
// no need to transfer (potentially large) file/image payload for this request
note.content = null;
}
noteContent.content = noteContent.content.toString("UTF-8");
}
return note;