Skip to content

Build your personal knowledge base with Trilium Notes

serialize binary note content into base64, incremented sync version

azivnerfec3e47eb8af
diff --git a/src/services/app_info.js b/src/services/app_info.js
index 5b7f4cffa9..781d8a712a 100644
--- a/src/services/app_info.js
+++ b/src/services/app_info.js
@@ -5,7 +5,7 @@ const packageJson = require('../../package');
const {TRILIUM_DATA_DIR} = require('./data_dir');
const APP_DB_VERSION = 121;
-const SYNC_VERSION = 2;
+const SYNC_VERSION = 3;
module.exports = {
appVersion: packageJson.version,
diff --git a/src/services/sync.js b/src/services/sync.js
index b508f6acd8..a081cfcc03 100644
--- a/src/services/sync.js
+++ b/src/services/sync.js
@@ -256,7 +256,7 @@ async function getEntityRow(entityName, entityId) {
&& entity.content !== null
&& (entity.type === 'file' || entity.type === 'image')) {
- entity.content = entity.content.toString("binary");
+ entity.content = entity.content.toString("base64");
}
return entity;
diff --git a/src/services/sync_update.js b/src/services/sync_update.js
index b03984206b..826aa1a368 100644
--- a/src/services/sync_update.js
+++ b/src/services/sync_update.js
@@ -40,7 +40,7 @@ async function updateEntity(sync, entity, sourceId) {
function deserializeNoteContentBuffer(note) {
if (note.content !== null && (note.type === 'file' || note.type === 'image')) {
- note.content = new Buffer(note.content, 'binary');
+ note.content = Buffer.from(note.content, 'base64');
}
}