jshint: fix Bad line breaking
This commit is contained in:
@@ -138,7 +138,7 @@ function prepareSql(sql) {
|
||||
|
||||
|
||||
function shouldQueryPostgresDirectly() {
|
||||
return global.environment
|
||||
&& global.environment.enabledFeatures
|
||||
&& global.environment.enabledFeatures.cdbQueryTablesFromPostgres;
|
||||
return global.environment &&
|
||||
global.environment.enabledFeatures &&
|
||||
global.environment.enabledFeatures.cdbQueryTablesFromPostgres;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ var CartodbWindshaft = function(serverOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
var redisPool = serverOptions.redis.pool
|
||||
|| require('redis-mpool')(_.extend(global.environment.redis, {name: 'windshaft:cartodb'}));
|
||||
var redisPool = serverOptions.redis.pool ||
|
||||
require('redis-mpool')(_.extend(global.environment.redis, {name: 'windshaft:cartodb'}));
|
||||
|
||||
var cartoData = require('cartodb-redis')({pool: redisPool});
|
||||
|
||||
|
||||
@@ -100,8 +100,7 @@ TemplateMapsController.prototype.update = function(req, res) {
|
||||
tpl_id = req.params.template_id.split('@');
|
||||
if ( tpl_id.length > 1 ) {
|
||||
if ( tpl_id[0] != cdbuser ) {
|
||||
err = new Error("Invalid template id '"
|
||||
+ req.params.template_id + "' for user '" + cdbuser + "'");
|
||||
err = new Error("Invalid template id '" + req.params.template_id + "' for user '" + cdbuser + "'");
|
||||
err.http_status = 404;
|
||||
throw err;
|
||||
}
|
||||
@@ -158,8 +157,8 @@ TemplateMapsController.prototype.retrieve = function(req, res) {
|
||||
tpl_id = req.params.template_id.split('@');
|
||||
if ( tpl_id.length > 1 ) {
|
||||
if ( tpl_id[0] != cdbuser ) {
|
||||
var err = new Error("Cannot get template id '"
|
||||
+ req.params.template_id + "' for user '" + cdbuser + "'");
|
||||
var err = new Error("Cannot get template id '" + req.params.template_id + "' for user '" + cdbuser +
|
||||
"'");
|
||||
err.http_status = 404;
|
||||
throw err;
|
||||
}
|
||||
@@ -220,8 +219,8 @@ TemplateMapsController.prototype.destroy = function(req, res) {
|
||||
tpl_id = req.params.template_id.split('@');
|
||||
if ( tpl_id.length > 1 ) {
|
||||
if ( tpl_id[0] != cdbuser ) {
|
||||
var err = new Error("Cannot find template id '"
|
||||
+ req.params.template_id + "' for user '" + cdbuser + "'");
|
||||
var err = new Error("Cannot find template id '" + req.params.template_id + "' for user '" +
|
||||
cdbuser + "'");
|
||||
err.http_status = 404;
|
||||
throw err;
|
||||
}
|
||||
@@ -361,9 +360,8 @@ TemplateMapsController.prototype.instantiateTemplate = function(req, res, templa
|
||||
var tpl_id = req.params.template_id.split('@');
|
||||
if ( tpl_id.length > 1 ) {
|
||||
if ( tpl_id[0] && tpl_id[0] != cdbuser ) {
|
||||
var err = new Error('Cannot instanciate map of user "'
|
||||
+ tpl_id[0] + '" on database of user "'
|
||||
+ cdbuser + '"');
|
||||
var err = new Error('Cannot instanciate map of user "' + tpl_id[0] + '" on database of user "' + cdbuser +
|
||||
'"');
|
||||
err.http_status = 403;
|
||||
callback(err);
|
||||
return;
|
||||
|
||||
@@ -35,8 +35,8 @@ var REQUEST_QUERY_PARAMS_WHITELIST = [
|
||||
];
|
||||
|
||||
module.exports = function(redisPool) {
|
||||
redisPool = redisPool
|
||||
|| require('redis-mpool')(_.extend(global.environment.redis, {name: 'windshaft:server_options'}));
|
||||
redisPool = redisPool ||
|
||||
require('redis-mpool')(_.extend(global.environment.redis, {name: 'windshaft:server_options'}));
|
||||
|
||||
var cartoData = require('cartodb-redis')({ pool: redisPool }),
|
||||
lzmaWorker = new LZMA(),
|
||||
@@ -377,14 +377,13 @@ module.exports = function(redisPool) {
|
||||
var host = req.headers.host;
|
||||
var mat = host.match(this.re_userFromHost);
|
||||
if ( ! mat ) {
|
||||
console.error("ERROR: user pattern '" + this.re_userFromHost
|
||||
+ "' does not match hostname '" + host + "'");
|
||||
console.error("ERROR: user pattern '" + this.re_userFromHost + "' does not match hostname '" + host + "'");
|
||||
return;
|
||||
}
|
||||
// console.log("Matches: "); console.dir(mat);
|
||||
if ( ! mat.length === 2 ) {
|
||||
console.error("ERROR: pattern '" + this.re_userFromHost
|
||||
+ "' gave unexpected matches against '" + host + "': " + mat);
|
||||
console.error("ERROR: pattern '" + this.re_userFromHost + "' gave unexpected matches against '" + host + "': " +
|
||||
mat);
|
||||
return;
|
||||
}
|
||||
return mat[1];
|
||||
|
||||
@@ -36,11 +36,11 @@ module.exports.query = function (username, api_key, sql, callback) {
|
||||
var reqSpec = {
|
||||
url:sqlapi,
|
||||
json:true,
|
||||
headers:{host: sqlapihostname}
|
||||
headers:{host: sqlapihostname},
|
||||
// http://nodejs.org/api/http.html#http_agent_maxsockets
|
||||
,pool:{maxSockets:maxSockets}
|
||||
pool:{maxSockets:maxSockets},
|
||||
// timeout in milliseconds
|
||||
,timeout:maxSQLTime
|
||||
timeout:maxSQLTime
|
||||
};
|
||||
if ( sql.length > maxGetLen ) {
|
||||
reqSpec.method = 'POST';
|
||||
|
||||
@@ -450,16 +450,14 @@ o.instance = function(template, params) {
|
||||
else if ( type === 'number' ) {
|
||||
// check it's a number
|
||||
if ( typeof(val) !== 'number' && ! val.match(_reNumber) ) {
|
||||
throw new Error("Invalid number value for template parameter '"
|
||||
+ k + "': " + val);
|
||||
throw new Error("Invalid number value for template parameter '" + k + "': " + val);
|
||||
}
|
||||
}
|
||||
else if ( type === 'css_color' ) {
|
||||
// check it only contains letters or
|
||||
// starts with # and only contains hexdigits
|
||||
if ( ! val.match(_reCSSColorName) && ! val.match(_reCSSColorVal) ) {
|
||||
throw new Error("Invalid css_color value for template parameter '"
|
||||
+ k + "': " + val);
|
||||
throw new Error("Invalid css_color value for template parameter '" + k + "': " + val);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user