mirror of
https://github.com/rommapp/romm.git
synced 2026-06-30 07:45:52 +00:00
fix: re-parse tags from filename when renaming a rom
Renaming a rom via PUT /roms/{id} only updated fs_name and its
derivatives, leaving regions/languages/tags/revision/version stale
against the new filename. Re-parse them whenever fs_name changes so
edits like "patapon (Fr En)" -> "Patapon (Fr, En)" are reflected in
the database.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1296,6 +1296,20 @@ async def update_rom(
|
||||
}
|
||||
)
|
||||
|
||||
# Re-parse tags from the filename so region/language/revision/version/tags
|
||||
# stay in sync whenever the fs_name changes.
|
||||
if new_fs_name != rom.fs_name:
|
||||
parsed_tags = fs_rom_handler.parse_tags(new_fs_name)
|
||||
cleaned_data.update(
|
||||
{
|
||||
"regions": parsed_tags.regions,
|
||||
"languages": parsed_tags.languages,
|
||||
"tags": parsed_tags.other_tags,
|
||||
"revision": parsed_tags.revision,
|
||||
"version": parsed_tags.version,
|
||||
}
|
||||
)
|
||||
|
||||
if remove_cover:
|
||||
cleaned_data.update(await fs_resource_handler.remove_cover(rom))
|
||||
cleaned_data.update({"url_cover": ""})
|
||||
|
||||
Reference in New Issue
Block a user