mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix error message building changing password of source
Do not change the password of the input parameter source during
anonymization, by using the proper helper instead of changing the
original uri directly.
eaa2dd8a97
This commit is contained in:
parent
63297c2ca4
commit
b1ab1ee046
2 changed files with 11 additions and 2 deletions
|
@ -171,8 +171,7 @@ module Gem
|
|||
# An English description of the error.
|
||||
|
||||
def wordy
|
||||
@source.uri.password = 'REDACTED' unless @source.uri.password.nil?
|
||||
"Unable to download data from #{@source.uri} - #{@error.message}"
|
||||
"Unable to download data from #{Gem::Uri.new(@source.uri).redacted} - #{@error.message}"
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -23,4 +23,14 @@ class TestGemSourceFetchProblem < Gem::TestCase
|
|||
|
||||
refute_match sf.wordy, 'secret'
|
||||
end
|
||||
|
||||
def test_source_password_no_redacted
|
||||
source = Gem::Source.new 'https://username:secret@gemsource.com'
|
||||
error = RuntimeError.new 'test'
|
||||
|
||||
sf = Gem::SourceFetchProblem.new source, error
|
||||
sf.wordy
|
||||
|
||||
assert_match 'secret', source.uri.to_s
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue