fix broken image sync

This commit is contained in:
azivner 2018-12-20 19:51:03 +01:00
parent 321d0e8d64
commit 14bd5d301d
2 changed files with 2 additions and 5 deletions

View File

@ -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;
}

View File

@ -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');
}
}