From 14bd5d301dd1b0c9a1a8ea564ee55b557cb6b1be Mon Sep 17 00:00:00 2001 From: azivner Date: Thu, 20 Dec 2018 19:51:03 +0100 Subject: [PATCH] fix broken image sync --- src/services/sync.js | 5 +---- src/services/sync_update.js | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/services/sync.js b/src/services/sync.js index 175704142..3a2b32e89 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 6db5cd9bb..a915cebb5 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'); } }