The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Rocket.Chat/packages/rocketchat-lib/lib/getURL.js

19 lines
541 B

RocketChat.getURL = (path, { cdn = true, full = false } = {}) => {
const cdnPrefix = _.rtrim(_.trim(RocketChat.settings.get('CDN_PREFIX') || ''), '/');
const pathPrefix = _.rtrim(_.trim(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX || ''), '/');
let basePath;
const finalPath = _.ltrim(_.trim(path), '/');
if (cdn && cdnPrefix !== '') {
basePath = cdnPrefix + pathPrefix;
} else if (full || Meteor.isCordova) {
return Meteor.absoluteUrl(finalPath);
} else {
basePath = pathPrefix;
}
return basePath + '/' + finalPath;
};