Skip to content

Commit

Permalink
Accept purge argument as true if it is empty but appears in query
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Gómez Macías committed Jul 2, 2018
1 parent 352a423 commit 8567fc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion controllers/agents.js
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,9 @@ router.delete('/', function(req, res) {
return;
}

data_request['arguments']['purge'] = 'purge' in req.query && (req.query['purge'] == true || req.query['purge'] == 'true');
logger.debug('purge' in req.query && (req.query.purge == 'true' || req.query.purge == ''));

data_request['arguments']['purge'] = 'purge' in req.query && (req.query.purge == true || req.query.purge == '');

if ('ids' in req.body)
data_request['arguments']['list_agent_ids'] = req.body.ids;
Expand Down
2 changes: 1 addition & 1 deletion helpers/input_validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ exports.timeframe_type = function(param) {

exports.boolean = function(n) {
if (typeof n != 'undefined'){
var regex = /^true|false$/;
var regex = /^$|(^true|false$)/;
return regex.test(n);
}
else
Expand Down

0 comments on commit 8567fc1

Please sign in to comment.