Skip to content

fix(recomp): let .7z / .rar mods through the import gates - #284

Merged
srsholmes merged 1 commit into
mainfrom
fix/recomp-import-7z-rar
Sep 16, 2026
Merged

srsholmes merged 1 commit into
mainfrom
fix/recomp-import-7z-rar

Conversation

@srsholmes

Copy link
Copy Markdown
Owner

Fixes #125.

Problem

Catalog mods declare acceptExtensions: ["zip","7z","rar"] (e.g. henriko-4k), and the extractor has unpacked .rar / .7z via bsdtar since #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 in importModFromDisk / 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 .7z and .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 from app.tsx), unchanged in behaviour apart from the wider set.

.appimage is deliberately not included: it's a download-only install type, never a user-picked import. bsdtar was already declared in the plugin's systemTools and is checked by loadout-doctor.

Verification

  • New lib/archive-extensions.test.ts: case-insensitive acceptance of every listed format, rejection of non-archives / .appimage / .7z.part, token derivation, acceptExtensions narrowing and fallback.
  • New backend test: Henriko 4K (3.0c).7z and GoldenEye-Recomp.RAR pass 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 test on 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

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
@srsholmes
srsholmes merged commit 0e8c73c into main Sep 16, 2026
2 checks passed
@srsholmes
srsholmes deleted the fix/recomp-import-7z-rar branch September 16, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recomp: support .7z/.rar for manual-import mods

1 participant