Skip to content

Commit

Permalink
Merge pull request #3318 from dependabot/npmrc-builder-lowercase-uri-…
Browse files Browse the repository at this point in the history
…component

NpmRcBuilder accept lowercase escaped slash
  • Loading branch information
thepwagner authored Mar 23, 2021
2 parents d7437a0 + c30444c commit 186b14a
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def registry_scopes(registry)
end

scopes = affected_urls.map do |url|
url.split(/\%40|@/)[1]&.split(%r{\%2F|/})&.first
url.split(/\%40|@/)[1]&.split(%r{\%2[fF]|/})&.first
end

# Registry used for unscoped packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,23 @@
to eq("@dependabot:registry=https://npm.fury.io/dependabot/")
end
end

context "that match a scoped package with lowercase escaped slash" do
let(:dependency_files) { project_dependency_files("npm6/private_source_lower") }
let(:credentials) do
[{
"type" => "git_source",
"host" => "github.com"
}, {
"type" => "npm_registry",
"registry" => "npm.fury.io/dependabot"
}]
end
it "adds auth details, and scopes them correctly" do
expect(npmrc_content).
to eq("@dependabot:registry=https://npm.fury.io/dependabot/")
end
end
end
end

Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/waltfy/PROTO_TEST.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/waltfy/PROTO_TEST/issues"
},
"homepage": "https://github.com/waltfy/PROTO_TEST#readme",
"dependencies": {
"fetch-factory": "^0.0.1",
"chalk": "^2.0.0"
},
"devDependencies": {
"@dependabot/etag": "^1.0.0",
"@dependabot/pack-core": "^2.0.1",
"@dependabot/pack-core-2": "^2.0.1",
"@dependabot/pack-core-3": "^2.0.1",
"@dependabot/pack-core-4": "^2.0.1"
}
}

0 comments on commit 186b14a

Please sign in to comment.