Fix: append .bak extension instead of replacing file extension#199
Conversation
tylergraydev
left a comment
There was a problem hiding this comment.
Good fix at line 550, but line 673 in pull_from_gist has the exact same bug:
let backup = claude_md_path.with_extension("md.bak");This needs the same with_file_name(format!("{}.bak", file_name)) treatment. Once that's addressed, this is good to go.
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 tylergraydev#195
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
99275d3 to
f74448e
Compare
|
Good catch — pushed the same fix to line 674 (now uses All Rust tests, Clippy, Format, and frontend-tests pass. The 4 |
tylergraydev
left a comment
There was a problem hiding this comment.
Both occurrences fixed, rebase looks clean. The 4 failing build checks are expected fork-PR behavior (Tauri signing secret). LGTM.
Summary
path.with_extension("md.bak")replaces the existing extension rather than appending.mdfiles this works by coincidence (CLAUDE.md→CLAUDE.md.bak).jsonfiles it would producesettings.md.bakinstead ofsettings.json.bakwith_file_name(format!("{}.bak", file_name))to properly append, matching the pattern inutils/backup.rsTest plan
CLAUDE.md.bakfoo.json→foo.json.bak)Relates to #195
🤖 Generated with Claude Code