mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
## What does this PR do? Fixes a bug where custom tarball URLs get corrupted during installation, causing 404 errors when installing packages from private registries. ## How did you test this change? - Added test case in `test/cli/install/bun-add.test.ts` that reproduces the issue with nested tarball dependencies - Verified the test fails without the fix and passes with it - Tested with debug build to confirm the fix resolves the URL corruption ## The Problem When installing packages from custom tarball URLs, the URLs were getting mangled with cache folder patterns. The issue had two root causes: 1. **Temporary directory naming**: The extract_tarball.zig code was including the full URL (including protocol) in temp directory names, causing string truncation issues with StringOrTinyString's 31-byte limit 2. **Empty package names**: Tarball dependencies with empty package names weren't being properly handled during deduplication, causing incorrect package lookups ## The Fix 1. **In extract_tarball.zig**: Now properly extracts just the filename from URLs using `std.fs.path.basename()` instead of including the full URL in temp directory names 2. **In PackageManagerEnqueue.zig**: Added handling for empty package names in tarball dependencies by falling back to the dependency name 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>