mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
RAHasher only decompresses .zip archives itself; any other container (.7z, .rar, .gz, .bz2, .xz, .tar, ...) was hashed as its raw archive bytes, silently storing a well-formed hash that matches nothing on RetroAchievements (issue #3808). Non-zip archives on buffer-hash platforms are now extracted to a temp file via the bundled 7zz binary and the extracted ROM is hashed instead. The new extract_largest_archive_member helper follows the existing 7zz subprocess patterns, handles single-stream formats whose listings carry no Attributes line (.gz/.xz), and unwraps one level of nesting so compressed tarballs (.tgz) reach the ROM inside the inner tar. Arcade is exempt: its RA hash is computed from the file's basename, so any container format already hashes correctly and extraction (which renames the file) would break it. Disc platforms keep their existing archive skip. When extraction fails (corrupt archive, or a codec the 7zz build lacks, e.g. RAR) no hash is stored at all and the 7zz stderr reason is logged at error level, so scan logs explain the missing hash instead of silently storing a garbage one. Fixes #3808 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>