diff options
author | isaacs <i@izs.me> | 2010-10-05 04:00:32 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-10-05 04:00:32 +0400 |
commit | 5436594f4970657de8b4a26f6265eff462f9baec (patch) | |
tree | 4d7bb5f6bfb03ecdf8808bc0f9f2b08b0b77a13e /lib/utils/read-json.js | |
parent | 80f7c0b57f9c7ff50826147048db8db0a5fb3cfb (diff) |
Don't allow spaces in names, and trim before checking
Diffstat (limited to 'lib/utils/read-json.js')
-rw-r--r-- | lib/utils/read-json.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/utils/read-json.js b/lib/utils/read-json.js index 804ef77b6..c275bde89 100644 --- a/lib/utils/read-json.js +++ b/lib/utils/read-json.js @@ -72,7 +72,8 @@ function processObject (opts, cb) { return function (er, json) { if (cb) return cb(e) throw e } - if (json.name.charAt(0) === "." || json.name.match(/[\/@]/)) { + json.name = json.name.trim() + if (json.name.charAt(0) === "." || json.name.match(/[\/@\s]/)) { var msg = "Invalid name: " + JSON.stringify(json.name) + " may not start with '.' or contain '/' or '@'" |