From 94a51921fda122ecd2b22a49a7a8e86026e9d6ae Mon Sep 17 00:00:00 2001 From: baldo Date: Sat, 6 May 2017 16:58:42 +0200 Subject: [PATCH] Fix: Remove trailing slash from URLs in config. Fixes: https://github.com/freifunkhamburg/ffffng/issues/33 --- server/config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/config.js b/server/config.js index ad70823..a3388d1 100644 --- a/server/config.js +++ b/server/config.js @@ -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);