mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 02:24:09 +01:00
When a ROM file is renamed or moved, the scan matched files to DB rows solely by (platform_id, fs_name), so the old row was flagged missing and the renamed file became a brand-new entry, orphaning all user data (collections, notes, per-user status, uploaded saves/states/screenshots). Now, when a scanned file matches no existing fs_name, the scan hashes it first and looks for an existing missing_from_fs entry on the same platform with a matching hash. On a match it moves that entry onto the new file and clears its missing state, preserving user data linked by rom_id, instead of inserting a duplicate. Empty hashes never match, so non-hashable platforms and SKIP_HASH_CALCULATION fall back to creating a new entry. File hashing is hoisted so it runs once per new file and is reused for both the reassociation probe and the downstream scan. Fixes #3618 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>