From 0f8721fe543b335e2ead265a5c586cc1ddcb2084 Mon Sep 17 00:00:00 2001 From: Andrew-McCall Date: Tue, 23 Sep 2025 22:57:58 +0100 Subject: [PATCH 1/4] Fixed double quotes on saved value --- src/setting/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setting/settings.ts b/src/setting/settings.ts index ab1f33bd..847d56fb 100644 --- a/src/setting/settings.ts +++ b/src/setting/settings.ts @@ -1315,7 +1315,7 @@ export class ObsidianGitSettingsTab extends PluginSettingTab { const defaultValue = DEFAULT_SETTINGS[settingsProperty]; if (defaultValue !== storedValue) { - text.setValue(JSON.stringify(storedValue)); + text.setValue(String(storedValue)); } } From 1aec1ac8be54f7975bfcfe3797700e2f12965add Mon Sep 17 00:00:00 2001 From: Andrew McCall Date: Thu, 25 Sep 2025 14:48:03 +0100 Subject: [PATCH 2/4] Made the linter check happy. --- src/setting/settings.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/setting/settings.ts b/src/setting/settings.ts index 847d56fb..53b30576 100644 --- a/src/setting/settings.ts +++ b/src/setting/settings.ts @@ -1314,8 +1314,12 @@ export class ObsidianGitSettingsTab extends PluginSettingTab { const storedValue = this.plugin.settings[settingsProperty]; const defaultValue = DEFAULT_SETTINGS[settingsProperty]; - if (defaultValue !== storedValue) { - text.setValue(String(storedValue)); + if (defaultValue !== storedValue && storedValue != null) { + if (typeof storedValue === "object") { + text.setValue(JSON.stringify(storedValue)); + }else { + text.setValue(String(storedValue)); + } } } From 2fd425167e93904590f12798f2c5e3433ad44e18 Mon Sep 17 00:00:00 2001 From: Andrew McCall Date: Thu, 25 Sep 2025 14:50:54 +0100 Subject: [PATCH 3/4] Simplified it to show intent more clearly --- src/setting/settings.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/setting/settings.ts b/src/setting/settings.ts index 53b30576..efeb0c98 100644 --- a/src/setting/settings.ts +++ b/src/setting/settings.ts @@ -1314,11 +1314,12 @@ export class ObsidianGitSettingsTab extends PluginSettingTab { const storedValue = this.plugin.settings[settingsProperty]; const defaultValue = DEFAULT_SETTINGS[settingsProperty]; - if (defaultValue !== storedValue && storedValue != null) { - if (typeof storedValue === "object") { - text.setValue(JSON.stringify(storedValue)); - }else { + if (defaultValue !== storedValue) { + // Doesn't add "" to saved strings + if (typeof storedValue === "string") { text.setValue(String(storedValue)); + }else { + text.setValue(JSON.stringify(storedValue)); } } } From 69d8b9598c967ec914ac35427314fdf02deb7f07 Mon Sep 17 00:00:00 2001 From: Andrew McCall Date: Thu, 25 Sep 2025 14:52:13 +0100 Subject: [PATCH 4/4] More handling --- src/setting/settings.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setting/settings.ts b/src/setting/settings.ts index efeb0c98..3093c726 100644 --- a/src/setting/settings.ts +++ b/src/setting/settings.ts @@ -1316,7 +1316,7 @@ export class ObsidianGitSettingsTab extends PluginSettingTab { if (defaultValue !== storedValue) { // Doesn't add "" to saved strings - if (typeof storedValue === "string") { + if (typeof storedValue === "string" || typeof storedValue === "number" || typeof storedValue === "boolean") { text.setValue(String(storedValue)); }else { text.setValue(JSON.stringify(storedValue));