fix(recomp): let .7z / .rar mods through the import gates - #284
Merged
Merged
Conversation
Fixes #125. The extractor has handled .rar/.7z via bsdtar since #167/#221, but the two gates in front of it were never widened: importModFromDisk / importGameFromDisk rejected the extension, and the import file-browser filtered them out of the picker. Catalog mods that only ship .7z/.rar (e.g. henriko-4k: acceptExtensions ["zip","7z","rar"]) therefore showed "no matching entries" and could not be imported at all. Move both allowlists into lib/archive-extensions.ts as a single source of truth: the backend gate uses the suffix list, the picker derives its single-token filter from the same list (.tar.gz → gz), and both now include .7z and .rar. .appimage stays out — download-only install type, never a user-picked import. Tests: unit coverage for the shared module (case-insensitivity, non-archives, token derivation, acceptExtensions narrowing + fallback) and a backend test proving .7z/.RAR pass the extension gate and reach the later registry check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uxy2FmYdbE2ojwbjoe6DCf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #125.
Problem
Catalog mods declare
acceptExtensions: ["zip","7z","rar"](e.g. henriko-4k), and the extractor has unpacked.rar/.7zviabsdtarsince #167 / #221 — with the same traversal + symlink pre-flight as tar/zip. But the two gates in front of the extractor were never widened:backend.ts—ALLOWED_ARCHIVE_EXTENSIONS = [".zip", ".tar", ".tar.gz", ".tgz"]rejected the path inimportModFromDisk/importGameFromDisk.app.tsx—BACKEND_ARCHIVE_EXTS = ["zip", "tar", "tgz", "gz"]filtered the picker, so a.7z/.rar-only mod showed "no matching entries" and could not be imported at all.Fix
One shared module,
plugins/recomp/lib/archive-extensions.ts, is now the single source of truth:ARCHIVE_EXTENSIONS— the suffix list the backend gate checks (hasArchiveExtension), now including.7zand.rar.ARCHIVE_PICKER_TOKENS— derived from the same list as single-token file-browser filters (.tar.gz→gz, deduplicated).supportedImportExtensions(accept)— the picker narrowing (moved fromapp.tsx), unchanged in behaviour apart from the wider set..appimageis deliberately not included: it's a download-only install type, never a user-picked import.bsdtarwas already declared in the plugin'ssystemToolsand is checked byloadout-doctor.Verification
lib/archive-extensions.test.ts: case-insensitive acceptance of every listed format, rejection of non-archives /.appimage/.7z.part, token derivation,acceptExtensionsnarrowing and fallback.Henriko 4K (3.0c).7zandGoldenEye-Recomp.RARpass the extension gate and reach the later registry check (the gate runs before the game lookup, so this proves ordering without touching the extractor).bun teston recomp backend + lib + UI spec: 72 pass, 0 fail. Typecheck (tsgo) clean, ESLint clean, knip clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Uxy2FmYdbE2ojwbjoe6DCf