From 1c557394636ce8f1adfb4400a209999b7b073f92 Mon Sep 17 00:00:00 2001 From: Scot Campbell <132853122+prefrontalsys@users.noreply.github.com> Date: Mon, 13 Apr 2026 11:06:52 -0400 Subject: [PATCH 1/2] Fix: append .bak extension instead of replacing file extension with_extension("md.bak") replaces the existing extension rather than appending. For .md files this produces the correct result by coincidence, but for .json files it would produce settings.md.bak instead of settings.json.bak. Use with_file_name(format!("{}.bak", file_name)) to properly append .bak, matching the approach used in utils/backup.rs. Relates to #195 Co-Authored-By: Claude Opus 4.6 --- src-tauri/src/services/gist_sync.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/services/gist_sync.rs b/src-tauri/src/services/gist_sync.rs index 8fcc264..011deb7 100644 --- a/src-tauri/src/services/gist_sync.rs +++ b/src-tauri/src/services/gist_sync.rs @@ -558,7 +558,8 @@ pub fn apply_pulled_payload( } // Back up existing file before overwriting if path.exists() { - let backup = path.with_extension("md.bak"); + let file_name = path.file_name().unwrap_or_default().to_string_lossy(); + let backup = path.with_file_name(format!("{}.bak", file_name)); let _ = std::fs::copy(&path, &backup); } std::fs::write(&path, content)?; From f74448ea4ef5eb358e4b29a1f710391a30202631 Mon Sep 17 00:00:00 2001 From: Scot Campbell <132853122+prefrontalsys@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:27:11 -0400 Subject: [PATCH 2/2] fix: preserve file extensions in pull_from_gist backup (line 674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applies the same fix from line 551 to line 674: use with_file_name(format!("{}.bak", file_name)) instead of with_extension("md.bak") to append .bak extension rather than replace it. Ensures settings.json → settings.json.bak instead of settings.md.bak --- src-tauri/src/commands/cloud_sync.rs | 4 ++-- src-tauri/src/services/gist_sync.rs | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/commands/cloud_sync.rs b/src-tauri/src/commands/cloud_sync.rs index 907f541..258b960 100644 --- a/src-tauri/src/commands/cloud_sync.rs +++ b/src-tauri/src/commands/cloud_sync.rs @@ -16,8 +16,8 @@ use tauri::State; fn find_gh() -> std::path::PathBuf { for candidate in &[ "/opt/homebrew/bin/gh", // Homebrew on Apple Silicon - "/usr/local/bin/gh", // Homebrew on Intel / manual install - "/usr/bin/gh", // System install + "/usr/local/bin/gh", // Homebrew on Intel / manual install + "/usr/bin/gh", // System install ] { if std::path::Path::new(candidate).exists() { return candidate.into(); diff --git a/src-tauri/src/services/gist_sync.rs b/src-tauri/src/services/gist_sync.rs index 011deb7..d83c510 100644 --- a/src-tauri/src/services/gist_sync.rs +++ b/src-tauri/src/services/gist_sync.rs @@ -682,7 +682,12 @@ pub fn apply_pulled_payload( } // Back up existing file before overwriting if claude_md_path.exists() { - let backup = claude_md_path.with_extension("md.bak"); + let file_name = claude_md_path + .file_name() + .unwrap_or_default() + .to_string_lossy(); + let backup = + claude_md_path.with_file_name(format!("{}.bak", file_name)); let _ = std::fs::copy(&claude_md_path, &backup); } if let Err(e) = std::fs::write(&claude_md_path, content) {