Skip to content

Commit

Permalink
update isConventionalTarballUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
indooorsman committed Nov 27, 2024
1 parent 8bfe2d5 commit d80dc92
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-npm/sources/NpmSemverFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ export class NpmSemverFetcher implements Fetcher {
registry = registry.replace(/^https:\/\/registry\.npmjs\.org($|\/)/, `https://registry.yarnpkg.com$1`);
url = url.replace(/^https:\/\/registry\.npmjs\.org($|\/)/, `https://registry.yarnpkg.com$1`);

// some registries store the tar ball in a path with duplicated scope,
// e.g. `https://my.registry.com/@my-scope/package-a/-/@my-scope/package-a-0.0.1.tgz`
url = url.replace(new RegExp(`^(.+)\\/@${locator.scope}\\/(.+)\\/@${locator.scope}\\/(.+)$`), `$1/@${locator.scope}/$2/$3`);

if (url === registry + path)
return true;
if (url === registry + path.replace(/%2f/g, `/`))
Expand Down

0 comments on commit d80dc92

Please sign in to comment.