Repository navigation
0.3.1 — Filename collision fix
🐛 The bug
A user with five Chinese-titled shows all localizing to 重生 under zh-CN saw recurring sync failures:
Failed to sync "重生" (show 159058): File already exists.
Five distinct underlying items (different Trakt ids, different IMDb ids, different originals — Born Again, Reborn, Go For Broke, Be Reborn…) all collapsed to the same display title under metadata localization. The default {{title}} ({{year}}) filename template produced the same 重生 (2020).md for two of them, vault.create() threw, and the failure repeated every sync.
This is a structural risk that grows with metadata-localization adoption — common-translation titles are exactly the cases localization improves the UI for, but they also collide more often.
✅ The fix — two-tier filename disambiguation
When the default filename collides with an existing note, the CREATE branch now progressively augments the {{title}} slot:
| Tier | Format | Example |
|---|---|---|
| 0 | {{title}} ({{year}}) (default) |
重生 (2020) |
| 1 | {{title}} (originalTitle) ({{year}}) |
重生 (Born Again) (2020) |
| 2 | {{title}} (originalTitle) [{{trakt_id}}] ({{year}}) |
重生 (Born Again) [157810] (2020) |
Tier 1 is skipped when originalTitle === title (i18n off, or proper noun) — its output would equal tier 0's. Tier 2 always succeeds since Trakt ids are globally unique.
The augmentation always goes into the {{title}} slot, so year / trakt_id / imdb_id positions in custom templates stay where the user put them. Default-template users keep the year-at-end visual convention.
🛡️ Tests
13 new smoke cases (cases 31-36 in tests/i18n.smoke.ts):
buildFilenamewithtitleOverridecorrectly substitutes{{title}}- All three tiers (no collision / tier 1 / tier 2)
- Same-title edge case skips tier 1
- Empty
originalTitletreated as same-title
Total tests: 221 (was 208). All passing.
🔄 Migration
No data migration. Existing notes unaffected. The 5th 重生 that was failing will land at 重生 (Born Again) (2020).md (or whichever tier is needed) on next sync. No user action required.
📦 Install / upgrade
- BRAT users: auto-updates on next Obsidian launch
- Manual install: download the three assets below, drop into
<vault>/.obsidian/plugins/obsidian-sync-trakt/
See the full changelog for all entries.
🤖 Generated with Claude Code