Skip to content

Choose the release archive file by tool name when installing - #111

Open
ZayanKhan-12 wants to merge 1 commit into
Roblox:mainfrom
ZayanKhan-12:choose-artifact-file-by-name
Open

Choose the release archive file by tool name when installing#111
ZayanKhan-12 wants to merge 1 commit into
Roblox:mainfrom
ZayanKhan-12:choose-artifact-file-by-name

Conversation

@ZayanKhan-12

Copy link
Copy Markdown

Fixes #97

Problem

ToolCache::download extracted archive.by_index(0) — literally the first entry of the release zip. Releases that also ship a license or readme can list those first, so foreman installs e.g. LICENSE.md as the tool binary. That's exactly what breaks Asphalt installs, as reported.

Fix

A choose_zip_file helper picks the entry to extract:

  1. an entry whose base name matches the tool name — asphalt or asphalt.exe for jackTabsCode/asphalt — case-insensitively and at any directory depth in the archive;
  2. otherwise the first entry that doesn't look like documentation (license/readme/changelog/notice prefixes, .md/.txt/.rst/.html/.pdf extensions);
  3. otherwise the first entry, preserving today's behavior exactly (single-binary archives are unaffected).

Verification

  • New regression test choose_zip_file_prefers_the_tool_name covering the Asphalt layout (LICENSE.md, README.md, asphalt → picks asphalt), Windows .exe naming, nested/case-insensitive matches, documentation skipping, and both fallback paths
  • cargo test --locked: all suites pass
  • cargo fmt -- --check clean; cargo clippy introduces no new warnings

🤖 Generated with Claude Code

Installation extracted the first entry of the release zip archive, so
releases that also ship files like a license or a readme could install
the wrong file entirely (e.g. Asphalt, whose archive lists LICENSE.md
before the binary).

Prefer an entry whose base name matches the tool name (with or without
the platform executable suffix, case-insensitively, at any directory
depth); otherwise take the first entry that does not look like
documentation; and fall back to the first entry as before.

Fixes Roblox#97

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Installation incorrectly picks the first file in an artifact folder

1 participant