Skip to content
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
4 changes: 0 additions & 4 deletions lib/mongo/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,6 @@ def parse!(remaining)
raise_invalid_error!("Options contain an unescaped question mark (?), or the database name contains a question mark and was not escaped")
end

if options && !hosts_and_db.index('/')
raise_invalid_error!("MongoDB URI must have a slash (/) after the hosts if options are given")
end

hosts, db = hosts_and_db.split('/', 2)
if db && db.index('/')
raise_invalid_error!("Database name contains an unescaped slash (/): #{db}")
Expand Down
9 changes: 0 additions & 9 deletions spec/mongo/uri_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,6 @@
end
end

context 'no slash after hosts, and options' do

let(:string) { 'mongodb://example.com?tls=true' }

it 'raises an error' do
expect { uri }.to raise_error(Mongo::Error::InvalidURI, %r,MongoDB URI must have a slash \(/\) after the hosts if options are given,)
end
end

context 'mongodb://example.com/?w' do

let(:string) { 'mongodb://example.com/?w' }
Expand Down
10 changes: 0 additions & 10 deletions spec/spec_tests/data/connection_string/invalid-uris.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,6 @@ tests:
hosts: ~
auth: ~
options: ~
-
description: "Missing delimiting slash between hosts and options"
uri: "mongodb://example.com?w=1"
valid: false
warning: ~
hosts: ~
auth: ~
options: ~
-
description: "Incomplete key value pair for option"
uri: "mongodb://example.com/?w"
Expand Down Expand Up @@ -257,5 +249,3 @@ tests:
hosts: ~
auth: ~
options: ~


13 changes: 13 additions & 0 deletions spec/spec_tests/data/connection_string/valid-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ tests:
db: "admin"
options:
authmechanism: "MONGODB-CR"
-
description: "Missing delimiting slash between hosts and options"
uri: "mongodb://example.com?tls=true"
valid: true
warning: false
hosts:
-
type: "hostname"
host: "example.com"
port: ~
auth: ~
options:
tls: true