diff --git a/scripts/updatedb.js b/scripts/updatedb.js index b207b705..a8738225 100644 --- a/scripts/updatedb.js +++ b/scripts/updatedb.js @@ -181,8 +181,10 @@ function check(database, cb) { function onResponse(response) { var status = response.statusCode; - - if (status !== 200) { + + if(status === 301 || status === 302 || status === 303 || status === 307 || status === 308) { + return https.get(getHTTPOptions(response.headers.location), onResponse); + } else if (status !== 200) { console.log(chalk.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]); client.abort(); process.exit(1); @@ -243,7 +245,9 @@ function fetch(database, cb) { function onResponse(response) { var status = response.statusCode; - if (status !== 200) { + if(status === 301 || status === 302 || status === 303 || status === 307 || status === 308) { + return https.get(getHTTPOptions(response.headers.location), onResponse); + } else if (status !== 200) { console.log(chalk.red('ERROR') + ': HTTP Request Failed [%d %s]', status, http.STATUS_CODES[status]); client.abort(); process.exit(1);