Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Re-sync Connection String Tests #272

Merged
merged 2 commits into from
Jan 31, 2018
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
7 changes: 7 additions & 0 deletions lib/uri_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ function parseConnectionString(uri, options, callback) {
if (typeof options === 'function') (callback = options), (options = {});
options = options || {};

// Check for bad uris before we parse
try {
URL.parse(uri);
} catch (e) {
return callback(new MongoParseError('URI malformed, cannot be parsed'));
}

const cap = uri.match(HOSTS_RX);
if (!cap) {
return callback(new MongoParseError('Invalid connection string'));
Expand Down
Loading