Skip to content

Commit 1c55739

Browse files
prefrontalsysclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 15db3ff commit 1c55739

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src-tauri/src/services/gist_sync.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ pub fn apply_pulled_payload(
558558
}
559559
// Back up existing file before overwriting
560560
if path.exists() {
561-
let backup = path.with_extension("md.bak");
561+
let file_name = path.file_name().unwrap_or_default().to_string_lossy();
562+
let backup = path.with_file_name(format!("{}.bak", file_name));
562563
let _ = std::fs::copy(&path, &backup);
563564
}
564565
std::fs::write(&path, content)?;

0 commit comments

Comments
 (0)