mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 17:26:38 +01:00
split out note's content into separate entity, WIP
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user