File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 16
16
# limitations under the License.
17
17
# ++
18
18
19
- require 'uri'
20
-
21
19
module Mongo
22
20
class URIParser
23
21
@@ -262,7 +260,8 @@ def parse_options(string_opts, extra_opts={})
262
260
263
261
return if string_opts . empty? && extra_opts . empty?
264
262
265
- opts = URI . decode_www_form ( string_opts ) . inject ( { } ) do |memo , ( key , value ) |
263
+ opts = string_opts . split ( /&|;/ ) . inject ( { } ) do |memo , kv |
264
+ key , value = kv . split ( '=' )
266
265
memo [ key . downcase . to_sym ] = value . strip . downcase
267
266
memo
268
267
end
Original file line number Diff line number Diff line change @@ -79,11 +79,11 @@ def test_opts_with_amp_separator
79
79
assert parser . safe
80
80
end
81
81
82
- def test_opts_made_invalid_by_mixed_separators
83
- assert_raise_error ArgumentError , "invalid data of application/x-www-form-urlencoded (replicaset=foo;bar&slaveok=true&safe=true)" do
84
- Mongo ::URIParser . new ( 'mongodb://localhost:27018?replicaset=foo;bar&slaveok=true&safe=true' )
85
- end
86
- end
82
+ # def test_opts_made_invalid_by_mixed_separators
83
+ # assert_raise_error ArgumentError, "invalid data of application/x-www-form-urlencoded (replicaset=foo;bar&slaveok=true&safe=true)" do
84
+ # Mongo::URIParser.new('mongodb://localhost:27018?replicaset=foo;bar&slaveok=true&safe=true')
85
+ # end
86
+ # end
87
87
88
88
def test_opts_safe
89
89
parser = Mongo ::URIParser . new ( 'mongodb://localhost:27018?safe=true;w=2;journal=true;fsync=true;wtimeoutMS=200' )
You can’t perform that action at this time.
0 commit comments