Skip to content

Commit 91fe0f3

Browse files
p-mongop
authored andcommitted
RUBY-2035 Use URI::DEFAULT_PARSER.unescape instead of URI.decode for Ruby 2.7 (#1614)
1 parent 0023f27 commit 91fe0f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/mongo/uri.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def raise_invalid_error_no_fmt!(details)
490490
end
491491

492492
def decode(value)
493-
::URI.decode(value)
493+
::URI::DEFAULT_PARSER.unescape(value)
494494
end
495495

496496
def encode(value)

spec/mongo/uri_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
let(:servers) { '%2Ftmp%2Fmongodb-27017.sock' }
353353

354354
it 'returns an array with the parsed server' do
355-
expect(uri.servers).to eq([URI.unescape(servers)])
355+
expect(uri.servers).to eq([URI::DEFAULT_PARSER.unescape(servers)])
356356
end
357357
end
358358

0 commit comments

Comments
 (0)