Skip to content

use public server url as alternative for mount #1270

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
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
2 changes: 1 addition & 1 deletion src/Adapters/Files/GridStoreAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class GridStoreAdapter extends FilesAdapter {
}

getFileLocation(config, filename) {
return (config.mount + '/files/' + config.applicationId + '/' + encodeURIComponent(filename));
return (config.publicServerURLOrMount + '/files/' + config.applicationId + '/' + encodeURIComponent(filename));
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export class Config {
get verifyEmailURL() {
return `${this.publicServerURL}/apps/${this.applicationId}/verify_email`;
}

// provide the public server URL if the mount differs from how the parse server is accessed from outside
get publicServerURLOrMount() {
return this.publicServerURL !== '' ? this.publicServerURL : this.mount;
}
};

export default Config;
Expand Down
2 changes: 1 addition & 1 deletion src/RestWrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ RestWrite.prototype.runAfterTrigger = function() {
RestWrite.prototype.location = function() {
var middle = (this.className === '_User' ? '/users/' :
'/classes/' + this.className + '/');
return this.config.mount + middle + this.data.objectId;
return this.config.publicServerURLOrMount + middle + this.data.objectId;
};

// A helper to get the object id for this operation.
Expand Down