Skip to content

Fix: append .bak extension instead of replacing file extension#199

Merged
tylergraydev merged 2 commits into
tylergraydev:mainfrom
prefrontalsys:fix/backup-extension-handling
Apr 14, 2026
Merged

Fix: append .bak extension instead of replacing file extension#199
tylergraydev merged 2 commits into
tylergraydev:mainfrom
prefrontalsys:fix/backup-extension-handling

Conversation

@prefrontalsys

Copy link
Copy Markdown
Contributor

Summary

  • path.with_extension("md.bak") replaces the existing extension rather than appending
  • For .md files this works by coincidence (CLAUDE.mdCLAUDE.md.bak)
  • For .json files it would produce settings.md.bak instead of settings.json.bak
  • Uses with_file_name(format!("{}.bak", file_name)) to properly append, matching the pattern in utils/backup.rs

Test plan

  • Pull with existing global CLAUDE.md — verify backup is created as CLAUDE.md.bak
  • If testing with other file types, verify extension is preserved (e.g. foo.jsonfoo.json.bak)

Relates to #195

🤖 Generated with Claude Code

@tylergraydev tylergraydev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

prefrontalsys and others added 2 commits April 14, 2026 14:32
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
@prefrontalsys prefrontalsys force-pushed the fix/backup-extension-handling branch from 99275d3 to f74448e Compare April 14, 2026 18:33
@prefrontalsys

Copy link
Copy Markdown
Contributor Author

Good catch — pushed the same fix to line 674 (now uses with_file_name(format!("{}.bak", file_name))). Also rebased onto latest main and fixed a stray rustfmt comment-alignment issue in cloud_sync.rs that surfaced after the rebase.

All Rust tests, Clippy, Format, and frontend-tests pass. The 4 build jobs fail with failed to decode secret key: incorrect updater private key password — that's expected fork-PR behavior since GitHub Actions doesn't share the Tauri signing secret with external fork PRs. Builds on main post-merge should be fine.

@tylergraydev tylergraydev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both occurrences fixed, rebase looks clean. The 4 failing build checks are expected fork-PR behavior (Tauri signing secret). LGTM.

@tylergraydev tylergraydev merged commit b3fa2bc into tylergraydev:main Apr 14, 2026
6 of 10 checks passed
@prefrontalsys prefrontalsys deleted the fix/backup-extension-handling branch April 15, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants