Skip to content

Commit

Permalink
Wrap suggested patched versions in quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
andriusm authored and postmodern committed Mar 2, 2022
1 parent 9cb6320 commit 017d1f5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/audit/cli/formats/junit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def bundle_title(result)

def advisory_solution(advisory)
unless advisory.patched_versions.empty?
"upgrade to #{advisory.patched_versions.join(' or ')}"
"upgrade to #{advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')}"
else
"remove or disable this gem until a patch is available!"
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/audit/cli/formats/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def print_advisory(gem, advisory)

unless advisory.patched_versions.empty?
say "Solution: upgrade to ", :red
say advisory.patched_versions.join(" or ")
say advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')
else
say "Solution: ", :red
say "remove or disable this gem until a patch is available!", [:red, :bold]
Expand Down
2 changes: 1 addition & 1 deletion spec/cli/formats/junit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@

context "when Advisory#patched_versions is not empty" do
it 'must print "Solution: upgrade to ..."' do
expect(output).to include("Solution: upgrade to #{CGI.escapeHTML(advisory.patched_versions.join(' or '))}")
expect(output).to include("Solution: upgrade to #{CGI.escapeHTML(advisory.patched_versions.map { |v| "'#{v}'" }.join(', '))}")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/cli/formats/text_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@

context "when Advisory#patched_versions is not empty" do
it 'must print "Solution: upgrade to ..."' do
expect(output_lines).to include("Solution: upgrade to #{advisory.patched_versions.join(' or ')}")
expect(output_lines).to include("Solution: upgrade to #{advisory.patched_versions.map { |v| "'#{v}'" }.join(', ')}")
end
end

Expand Down

0 comments on commit 017d1f5

Please sign in to comment.