mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	serialize binary note content into base64, incremented sync version
This commit is contained in:
		@@ -5,7 +5,7 @@ const packageJson = require('../../package');
 | 
				
			|||||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
 | 
					const {TRILIUM_DATA_DIR} = require('./data_dir');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_DB_VERSION = 121;
 | 
					const APP_DB_VERSION = 121;
 | 
				
			||||||
const SYNC_VERSION = 2;
 | 
					const SYNC_VERSION = 3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
    appVersion: packageJson.version,
 | 
					    appVersion: packageJson.version,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -256,7 +256,7 @@ async function getEntityRow(entityName, entityId) {
 | 
				
			|||||||
            && entity.content !== null
 | 
					            && entity.content !== null
 | 
				
			||||||
            && (entity.type === 'file' || entity.type === 'image')) {
 | 
					            && (entity.type === 'file' || entity.type === 'image')) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            entity.content = entity.content.toString("binary");
 | 
					            entity.content = entity.content.toString("base64");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return entity;
 | 
					        return entity;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ async function updateEntity(sync, entity, sourceId) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function deserializeNoteContentBuffer(note) {
 | 
					function deserializeNoteContentBuffer(note) {
 | 
				
			||||||
    if (note.content !== null && (note.type === 'file' || note.type === 'image')) {
 | 
					    if (note.content !== null && (note.type === 'file' || note.type === 'image')) {
 | 
				
			||||||
        note.content = new Buffer(note.content, 'binary');
 | 
					        note.content = Buffer.from(note.content, 'base64');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user