Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
token: Fix CIDR list processing to handle comma separated items corre…
Browse files Browse the repository at this point in the history
…ctly

This got broken by having the config-type set to Array.  When it was a
String, it worked correctly.
  • Loading branch information
iarna committed Feb 1, 2018
1 parent 0db14ba commit 4b39027
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ function validateCIDR (cidr) {
}

function validateCIDRList (cidrs) {
const list = Array.isArray(cidrs) ? cidrs : cidrs ? cidrs.split(/,\s*/) : []
const maybeList = cidrs ? (Array.isArray(cidrs) ? cidrs : [cidrs]) : []
const list = maybeList.length == 1 ? maybeList[0].split(/,\s*/) : maybeList
list.forEach(validateCIDR)
return list
}

0 comments on commit 4b39027

Please sign in to comment.