Fix logical error in legacy config expression

We should check for an undefined and not just for a logical true or
false.

Example: When `usecdn` was set to false it was impossible to overwrite
the new config value because the if statement becomes false.

Thanks @davidmehren for pointing me to this issue.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2018-03-26 20:49:24 +02:00
parent 4eef661c15
commit 10a81e7db2
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD

View file

@ -110,8 +110,8 @@ for (let i = keys.length; i--;) {
// and the config with uppercase is not set // and the config with uppercase is not set
// we set the new config using the old key. // we set the new config using the old key.
if (uppercase.test(keys[i]) && if (uppercase.test(keys[i]) &&
config[lowercaseKey] && config[lowercaseKey] !== undefined &&
!config[keys[1]]) { fileConfig[keys[i]] === undefined) {
logger.warn('config.js contains deprecated lowercase setting for ' + keys[i] + '. Please change your config.js file to replace ' + lowercaseKey + ' with ' + keys[i]) logger.warn('config.js contains deprecated lowercase setting for ' + keys[i] + '. Please change your config.js file to replace ' + lowercaseKey + ' with ' + keys[i])
config[keys[i]] = config[lowercaseKey] config[keys[i]] = config[lowercaseKey]
} }