Skip to content

Commit

Permalink
Fixes issues with TypeError:Passed nil into T.must (#10603)
Browse files Browse the repository at this point in the history
* Fixes unescaped error handler
  • Loading branch information
sachin-sandhu authored Sep 14, 2024
1 parent 902c1da commit 99fc141
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
3 changes: 2 additions & 1 deletion npm_and_yarn/lib/dependabot/npm_and_yarn/registry_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def dependency_name
resolved_url
end

T.must(T.must(url_base[/@.*/]).gsub("%2F", "/").split("/")[0..1]).join("/")
package_name = url_base.gsub("%2F", "/").match(%r{@.*/})
"#{T.must(package_name)}#{T.must(url_base.gsub('%2F', '/').split('/').last)}"
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@
end
end

context "when there is a lockfile with tarball urls we don't have access to" do
let(:project_name) { "pnpm/private_package_access" }

it "raises a helpful error" do
expect { updated_pnpm_lock_content }
.to raise_error(Dependabot::PrivateSourceAuthenticationFailure)
end
end

context "when there is a unsupported engine response from registry" do
let(:dependency_name) { "@blocknote/core" }
let(:version) { "0.15.4" }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@private-pkg:registry=https://npm.pkg.github.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"@private-pkg/inner-source-top-secret-npm-2": "1.0.3"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 99fc141

Please sign in to comment.