Skip to content

Commit

Permalink
validate draft name before calling through to ietf
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Jun 20, 2021
1 parent 048d347 commit c1902d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ const [subcommand = 'help'] = argv._
}

case 'draft': {
if (!/draft-ring-analyticstxt-0[01]/.test(argv.draft)) {
throw new Error(
'Received malformed or unknown draft name, cannot continue. ' +
'Check `drafts` for a list of available documents.'
)
}

const url = `https://www.ietf.org/archive/id/${argv.draft}.txt`
const content = await new Promise(function (resolve, reject) {
https.get(url, function (res) {
Expand Down

0 comments on commit c1902d6

Please sign in to comment.