Fix: Remove trailing slash from URLs in config.
Fixes: https://github.com/freifunkhamburg/ffffng/issues/33
This commit is contained in:
parent
7604ba0848
commit
94a51921fd
1 changed files with 10 additions and 0 deletions
|
@ -126,8 +126,18 @@ if (fs.existsSync(configJSONFile)) {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
function stripTrailingSlash(obj, field) {
|
||||
var url = obj[field];
|
||||
if (_.isString(url) && _.last(url) === '/') {
|
||||
obj[field] = url.substr(0, url.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
var config = deepExtend({}, defaultConfig, configJSON);
|
||||
|
||||
stripTrailingSlash(config.server, 'baseUrl');
|
||||
stripTrailingSlash(config.client.map, 'mapUrl');
|
||||
|
||||
module.exports = config;
|
||||
|
||||
angular.module('ffffng').constant('config', config);
|
||||
|
|
Loading…
Reference in a new issue