Skip to content

Commit 524c7ef

Browse files
committed
Fix syncable check in events listener
1 parent f23c00c commit 524c7ef

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/events-listener.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,24 @@ export default class EventsListener {
116116
}
117117

118118
private isSyncable(filePath: string) {
119-
return (
120-
filePath === `${this.vault.configDir}/github-sync-metadata.json` ||
121-
(this.settings.syncConfigDir &&
122-
filePath.startsWith(this.vault.configDir)) ||
123-
// Obsidian recommends not syncing the workspace files
119+
if (filePath === `${this.vault.configDir}/github-sync-metadata.json`) {
120+
// Manifest file must always be synced
121+
return true;
122+
} else if (
124123
filePath === `${this.vault.configDir}/workspace.json` ||
125124
filePath === `${this.vault.configDir}/workspace-mobile.json`
126-
);
125+
) {
126+
// Obsidian recommends not syncing the workspace files
127+
return false;
128+
} else if (
129+
this.settings.syncConfigDir &&
130+
filePath.startsWith(this.vault.configDir)
131+
) {
132+
// Sync configs only if the user explicitly wants to
133+
return true;
134+
} else {
135+
// All other files can be synced
136+
return true;
137+
}
127138
}
128139
}

0 commit comments

Comments
 (0)