mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
A slot-less POST /api/saves behaves as a filename upsert, and two details combined into silent save corruption. 1. get_save_by_filename only filtered by slot when one was passed, so a slot-less lookup could match (and overwrite) a save row living in a named slot. Scope slot=None to the null-slot save (Save.slot IS NULL) so a slot-less upload can never adopt a row from another slot. get_save_by_content_hash keeps its documented cross-slot slot=None behavior (dedup-only, non-destructive). 2. The upsert branch only wrote file_size_bytes and content_hash while the bytes landed under a path derived from the request's emulator, so the row's hash could disagree with the file it still pointed at. Also persist file_path/emulator, and remove the now-orphaned file when the row's location changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>