diff options
author | Chris Ball <cjb@laptop.org> | 2010-04-05 13:09:29 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-04-05 13:09:29 -0400 |
commit | dc553ec9c0a172c51a69ce2fe9599c1123d493ba (patch) | |
tree | 7812a71d45caf8d629aa4856e7fab6985c025e3f /etherpad/src | |
parent | 6d5f97d67df88ba77cb38f62c08dcba9fe306f87 (diff) | |
download | etherpad-dc553ec9c0a172c51a69ce2fe9599c1123d493ba.tar.gz etherpad-dc553ec9c0a172c51a69ce2fe9599c1123d493ba.tar.bz2 etherpad-dc553ec9c0a172c51a69ce2fe9599c1123d493ba.zip |
Make config parsing more robust
Previously, config booleans like etherpad.isProduction accepted only
"true", and not "true " or " true" or "True" or "TRUE". Fix that.
Diffstat (limited to 'etherpad/src')
-rw-r--r-- | etherpad/src/etherpad/globals.js | 4 | ||||
-rw-r--r-- | etherpad/src/etherpad/pne/pne_utils.js | 3 | ||||
-rw-r--r-- | etherpad/src/main.js | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/etherpad/src/etherpad/globals.js b/etherpad/src/etherpad/globals.js index 343a989..8087337 100644 --- a/etherpad/src/etherpad/globals.js +++ b/etherpad/src/etherpad/globals.js @@ -22,8 +22,10 @@ var COMETPATH = "/comet"; var COLOR_PALETTE = ['#ffc7c7','#fff1c7','#e3ffc7','#c7ffd5','#c7ffff','#c7d5ff','#e3c7ff','#ffc7f1','#ff8f8f','#ffe38f','#c7ff8f','#8fffab','#8fffff','#8fabff','#c78fff','#ff8fe3','#d97979','#d9c179','#a9d979','#79d991','#79d9d9','#7991d9','#a979d9','#d979c1','#d9a9a9','#d9cda9','#c1d9a9','#a9d9b5','#a9d9d9','#a9b5d9','#c1a9d9','#d9a9cd']; +var trueRegex = /\s*true\s*/i; + function isProduction() { - return (appjet.config['etherpad.isProduction'] == "true"); + return (trueRegex.test(appjet.config['etherpad.isProduction'])); } var SUPERDOMAINS = { diff --git a/etherpad/src/etherpad/pne/pne_utils.js b/etherpad/src/etherpad/pne/pne_utils.js index 3169407..bc105bd 100644 --- a/etherpad/src/etherpad/pne/pne_utils.js +++ b/etherpad/src/etherpad/pne/pne_utils.js @@ -72,7 +72,8 @@ function checkDbVersionUpgrade() { var dbVersion = parseVersionString(dbVersionString); var runningVersion = getVersionNumbers(); - var force = (appjet.config['etherpad.forceDbUpgrade'] == "true"); + var trueRegex = /\s*true\s*/i; + var force = trueRegex.test(appjet.config['etherpad.forceDbUpgrade']); if (!force && (runningVersion.major != dbVersion.major)) { println("Error: you are attempting to update an EtherPad["+dbVersionString+ diff --git a/etherpad/src/main.js b/etherpad/src/main.js index 745f5fa..c881223 100644 --- a/etherpad/src/main.js +++ b/etherpad/src/main.js @@ -259,7 +259,8 @@ function checkRequestIsWellFormed() { // checkHost() //---------------------------------------------------------------- function checkHost() { - if (appjet.config['etherpad.skipHostnameCheck'] == "true") { + var trueRegex = /\s*true\s*/i; + if (trueRegex.test(appjet.config['etherpad.skipHostnameCheck'])) { return; } |