image sync fixes and 4.0.0 electron

This commit is contained in:
azivner
2018-12-22 09:54:09 +01:00
parent cbec85f295
commit e9a77f3f16
5 changed files with 25 additions and 16 deletions

View File

@@ -252,7 +252,10 @@ async function getEntityRow(entityName, entityId) {
const entity = await sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);
if (entityName === 'notes' && (entity.type === 'file' || entity.type === 'image')) {
if (entityName === 'notes'
&& entity.content !== null
&& (entity.type === 'file' || entity.type === 'image')) {
entity.content = entity.content.toString("binary");
}

View File

@@ -16,7 +16,13 @@ async function get(name) {
module.exports = {
getSyncServerHost: async () => await get('syncServerHost'),
isSyncSetup: async () => !!await get('syncServerHost'),
isSyncSetup: async () => {
const syncServerHost = await get('syncServerHost');
// special value "disabled" is here to support use case where document is configured with sync server
// and we need to override it with config from config.ini
return !!syncServerHost && syncServerHost !== 'disabled';
},
getSyncTimeout: async () => parseInt(await get('syncServerTimeout')),
getSyncProxy: async () => await get('syncProxy')
};

View File

@@ -39,7 +39,7 @@ async function updateEntity(sync, entity, sourceId) {
}
function deserializeNoteContentBuffer(note) {
if (note.type === 'file' || note.type === 'image') {
if (note.content !== null && (note.type === 'file' || note.type === 'image')) {
note.content = new Buffer(note.content, 'binary');
}
}