Skip to content
Closed
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
13 changes: 12 additions & 1 deletion ExportAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down
2 changes: 1 addition & 1 deletion transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just merged this in #146 ?

restObject[key] = {
__type: 'File',
name: mongoObject[key]
Expand Down