Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert sanitization of package name #7246

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -575,15 +575,10 @@ def yarnrc_content
end

def sanitized_package_json_content(content)
updated_content =
content.
content.
gsub(/\{\{[^\}]*?\}\}/, "something"). # {{ nm }} syntax not allowed
gsub(/(?<!\\)\\ /, " "). # escaped whitespace not allowed
gsub(%r{^\s*//.*}, " ") # comments are not allowed

json = JSON.parse(updated_content)
json["name"] = json["name"].delete(" ") if json["name"].is_a?(String)
json.to_json
end

def sanitize_package_name(package_name)
Expand Down
20 changes: 0 additions & 20 deletions npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@
end
end

context "with a name that needs sanitizing" do
let(:files) { project_dependency_files("npm6/invalid_name") }

it "updates the files" do
expect { updated_files }.to_not(change { Dir.entries(tmp_path) })
updated_files.each { |f| expect(f).to be_a(Dependabot::DependencyFile) }
expect(updated_files.count).to eq(2)
end
end

context "with multiple dependencies" do
let(:files) { project_dependency_files("npm6_and_yarn/multiple_updates") }

Expand Down Expand Up @@ -1561,16 +1551,6 @@
end
end

context "with a name that needs sanitizing" do
let(:files) { project_dependency_files("npm8/invalid_name") }

it "updates the files" do
expect { updated_files }.to_not(change { Dir.entries(tmp_path) })
updated_files.each { |f| expect(f).to be_a(Dependabot::DependencyFile) }
expect(updated_files.count).to eq(2)
end
end

context "with multiple dependencies" do
let(:files) { project_dependency_files("npm8/multiple_updates") }

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading