From 524c7efed7227511faf9ea4d857dc3d8052c3433 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Thu, 23 Jan 2025 13:12:42 +0100 Subject: [PATCH] Fix syncable check in events listener --- src/events-listener.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/events-listener.ts b/src/events-listener.ts index 438a619..ee9dbea 100644 --- a/src/events-listener.ts +++ b/src/events-listener.ts @@ -116,13 +116,24 @@ export default class EventsListener { } private isSyncable(filePath: string) { - return ( - filePath === `${this.vault.configDir}/github-sync-metadata.json` || - (this.settings.syncConfigDir && - filePath.startsWith(this.vault.configDir)) || - // Obsidian recommends not syncing the workspace files + if (filePath === `${this.vault.configDir}/github-sync-metadata.json`) { + // Manifest file must always be synced + return true; + } else if ( filePath === `${this.vault.configDir}/workspace.json` || filePath === `${this.vault.configDir}/workspace-mobile.json` - ); + ) { + // Obsidian recommends not syncing the workspace files + return false; + } else if ( + this.settings.syncConfigDir && + filePath.startsWith(this.vault.configDir) + ) { + // Sync configs only if the user explicitly wants to + return true; + } else { + // All other files can be synced + return true; + } } }