From b2a854d1aa221778292febc5adb86d21309c7bf0 Mon Sep 17 00:00:00 2001 From: Taylor Stine Date: Mon, 1 Feb 2016 14:15:30 -0500 Subject: [PATCH 1/3] Added encoding to user name and password --- ExportAdapter.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ExportAdapter.js b/ExportAdapter.js index 89cb6c5900..ffb493fe7f 100644 --- a/ExportAdapter.js +++ b/ExportAdapter.js @@ -34,8 +34,19 @@ ExportAdapter.prototype.connect = function() { return this.connectionPromise; } + var usernameStart = this.mongoURI.indexOf('://') + 3; + var lastAtIndex = this.mongoURI.lastIndexOf('@'); + var encodedMongoURI = this.mongoURI; + var username = null; + var password = null; + var split = null + if (lastAtIndex > 0) { + split = this.mongoURI.slice(usernameStart, lastAtIndex).split(':'); + encodedMongoURI = this.mongoURI.slice(0, usernameStart) + encodeURIComponent(split[0]) + ':' + encodeURIComponent(split[1]) + this.mongoURI.slice(lastAtIndex); + } + this.connectionPromise = Promise.resolve().then(() => { - return MongoClient.connect(this.mongoURI); + return MongoClient.connect(encodedMongoURI, {uri_decode_auth:true}); }).then((db) => { this.db = db; }); From 46ceeb70d2980dafdd3059aa1b5f4f22ac1d5e21 Mon Sep 17 00:00:00 2001 From: Taylor Stine Date: Mon, 1 Feb 2016 15:41:22 -0500 Subject: [PATCH 2/3] Added cloud funciton argument --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 79a321986f..ae526e1938 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,14 @@ function ParseServer(args) { } if (args.cloud) { addParseCloud(); - require(args.cloud); + if (typeof args.cloud === 'function') { + args.cloud(Parse) + } else if (typeof args.cloud === 'string') { + require(args.cloud); + } else { + throw "argument 'cloud' must either be a string or a function"; + } + } cache.apps[args.appId] = { From 6b0632d5c7e2ef326be355a5b78cdcd8d284f904 Mon Sep 17 00:00:00 2001 From: Taylor Stine Date: Mon, 1 Feb 2016 15:41:40 -0500 Subject: [PATCH 3/3] Fixed bug with null file field --- transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transform.js b/transform.js index 7e19ba7035..1ff2c58113 100644 --- a/transform.js +++ b/transform.js @@ -691,7 +691,7 @@ function untransformObject(schema, className, mongoObject) { throw ('bad key in untransform: ' + key); } else { var expected = schema.getExpectedType(className, key); - if (expected == 'file') { + if (expected == 'file' && mongoObject[key]) { restObject[key] = { __type: 'File', name: mongoObject[key]