fix attachment sync

This commit is contained in:
azivner
2018-02-18 22:55:36 -05:00
parent aa2bbc6575
commit 131af9ab12
4 changed files with 24 additions and 5 deletions

View File

@@ -1,10 +1,17 @@
const sql = require('./sql');
const log = require('./log');
const eventLog = require('./event_log');
const notes = require('./notes');
const sync_table = require('./sync_table');
function deserializeNoteContentBuffer(note) {
if (note.type === 'file') {
note.content = new Buffer(note.content, 'binary');
}
}
async function updateNote(entity, sourceId) {
deserializeNoteContentBuffer(entity);
const origNote = await sql.getRow("SELECT * FROM notes WHERE noteId = ?", [entity.noteId]);
if (!origNote || origNote.dateModified <= entity.dateModified) {