Skip to content

fix(packument): preserve URL path segments when constructing request URLs#19

Merged
indexzero merged 1 commit intomainfrom
fix/registry-urls
Feb 1, 2026
Merged

fix(packument): preserve URL path segments when constructing request URLs#19
indexzero merged 1 commit intomainfrom
fix/registry-urls

Conversation

@indexzero
Copy link
Copy Markdown
Owner

@indexzero indexzero commented Feb 1, 2026

The PackumentClient was using new URL('/${package}', origin) which replaces the entire pathname of the base URL rather than appending to it. This caused registries with path segments (e.g., /javascript) to lose their path when constructing package URLs.

Before: https://registry.example.com/javascript + lodash
     => https://registry.example.com/lodash (wrong)

After:  https://registry.example.com/javascript + lodash
     => https://registry.example.com/javascript/lodash (correct)

Also adds comprehensive tests for PackumentClient covering:

  • URL construction with various path configurations
  • Basic packument fetching from npm
  • Scoped package handling
  • 404 response handling
  • Batch requests via requestAll()

…URLs

The PackumentClient was using `new URL('/${package}', origin)` which
replaces the entire pathname of the base URL rather than appending to it.
This caused registries with path segments (e.g., /javascript) to lose
their path when constructing package URLs.

Before: https://registry.example.com/javascript + lodash
     => https://registry.example.com/lodash (wrong)

After:  https://registry.example.com/javascript + lodash
     => https://registry.example.com/javascript/lodash (correct)

Also adds comprehensive tests for PackumentClient covering:
- URL construction with various path configurations
- Basic packument fetching from npm
- Scoped package handling
- 404 response handling
- Batch requests via requestAll()
@indexzero indexzero changed the title fix(packument): preserve URL path segments when constructing request … fix(packument): preserve URL path segments when constructing request URLs Feb 1, 2026
@indexzero indexzero merged commit 0fa5278 into main Feb 1, 2026
1 check passed
@indexzero indexzero deleted the fix/registry-urls branch February 1, 2026 03:20
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.

1 participant