Skip to content

Commit 123ac5f

Browse files
committed
Merge pull request #297 from taylorstine/mongo_uri
reverted uri encoding
2 parents 5c8f09b + f504cbb commit 123ac5f

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

ExportAdapter.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,8 @@ ExportAdapter.prototype.connect = function() {
3434
return this.connectionPromise;
3535
}
3636

37-
//http://regexr.com/3cncm
38-
if (!this.mongoURI.match(/^mongodb:\/\/((.+):(.+)@)?([^:@]+):{0,1}([^:]+)\/(.+?)$/gm)) {
39-
throw new Error("Invalid mongoURI: " + this.mongoURI)
40-
}
41-
var usernameStart = this.mongoURI.indexOf('://') + 3;
42-
var lastAtIndex = this.mongoURI.lastIndexOf('@');
43-
var encodedMongoURI = this.mongoURI;
44-
var split = null;
45-
if (lastAtIndex > 0) {
46-
split = this.mongoURI.slice(usernameStart, lastAtIndex).split(':');
47-
encodedMongoURI = this.mongoURI.slice(0, usernameStart) + encodeURIComponent(split[0]) + ':' + encodeURIComponent(split[1]) + this.mongoURI.slice(lastAtIndex);
48-
}
49-
5037
this.connectionPromise = Promise.resolve().then(() => {
51-
return MongoClient.connect(encodedMongoURI, {uri_decode_auth:true});
38+
return MongoClient.connect(this.mongoURI);
5239
}).then((db) => {
5340
this.db = db;
5441
});

0 commit comments

Comments
 (0)