diff --git a/core/server/config/utils.js b/core/server/config/utils.js index 8c4058e311..aa177dd095 100644 --- a/core/server/config/utils.js +++ b/core/server/config/utils.js @@ -34,13 +34,12 @@ exports.makePathsAbsolute = function makePathsAbsolute(obj, parent) { _.each(obj, function (configValue, pathsKey) { if (_.isObject(configValue)) { makePathsAbsolute.bind(self)(configValue, parent + ':' + pathsKey); - } else { - if (_.isString(configValue) && - (configValue.match(/\/+|\\+/) || configValue === '.') && - (configValue[0] !== '/' && configValue[0] !== '\\') - ) { - self.set(parent + ':' + pathsKey, path.join(__dirname + '/../../../', configValue)); - } + } else if ( + _.isString(configValue) && + (configValue.match(/\/+|\\+/) || configValue === '.') && + !path.isAbsolute(configValue) + ) { + self.set(parent + ':' + pathsKey, path.normalize(path.join(__dirname, '../../..', configValue))); } }); }; diff --git a/core/test/unit/config/utils_spec.js b/core/test/unit/config/utils_spec.js index df1769aeda..7cb7fba4ee 100644 --- a/core/test/unit/config/utils_spec.js +++ b/core/test/unit/config/utils_spec.js @@ -41,7 +41,7 @@ describe('UNIT: Config utils', function () { changedKey.length.should.eql(0); }); - it('ensure we don\' change absolute paths', function () { + it('ensure we don\'t change absolute paths', function () { var changedKey = [], obj = { database: {