Skip to content

Build your personal knowledge base with Trilium Notes

fix broken image sync

azivner14bd5d301dd1
diff --git a/src/services/sync.js b/src/services/sync.js
index 1757041426..3a2b32e890 100644
--- a/src/services/sync.js
+++ b/src/services/sync.js
@@ -252,12 +252,9 @@ async function getEntityRow(entityName, entityId) {
const entity = await sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);
- if (entityName === 'notes' && entity.type === 'file') {
+ if (entityName === 'notes' && (entity.type === 'file' || entity.type === 'image')) {
entity.content = entity.content.toString("binary");
}
- else if (entityName === 'images') {
- entity.data = entity.data.toString('base64');
- }
return entity;
}
diff --git a/src/services/sync_update.js b/src/services/sync_update.js
index 6db5cd9bb4..a915cebb58 100644
--- a/src/services/sync_update.js
+++ b/src/services/sync_update.js
@@ -39,7 +39,7 @@ async function updateEntity(sync, entity, sourceId) {
}
function deserializeNoteContentBuffer(note) {
- if (note.type === 'file') {
+ if (note.type === 'file' || note.type === 'image') {
note.content = new Buffer(note.content, 'binary');
}
}