Skip to content

Commit 26014a1

Browse files
author
Rowan Wookey
committed
v1.2.0
* Updated NPM deps fixing security issues * Replaced xtraverse with maintained libxmljs2 thanks to @tomarad jaredhanson#100 * Updated travis node versions, minimum node version is now 10
1 parent b020741 commit 26014a1

5 files changed

Lines changed: 952 additions & 106 deletions

File tree

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: "node_js"
22
node_js:
3-
- "6"
4-
- "8"
53
- "10"
6-
4+
- "12"
5+
- "14"
6+
- "15"
77

88
before_install:
99
- "npm install make-node@0.3.x -g"

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 1.2.0 (2021-04-19)
2+
3+
* Updated NPM deps fixing security issues
4+
* Replaced xtraverse with maintained libxmljs2 thanks to @tomarad jaredhanson/passport-twitter#100
5+
* Updated travis node versions, minimum node version is now 10
6+
17
# 1.1.0 (2018-06-29)
28

39
* Added CHANGELOG.md @rwky

lib/strategy.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var OAuthStrategy = require('@passport-next/passport-oauth1')
33
, util = require('util')
44
, uri = require('url')
5-
, XML = require('xtraverse')
5+
, XML = require('libxmljs2')
66
, Profile = require('./profile')
77
, InternalOAuthError = require('@passport-next/passport-oauth1').InternalOAuthError
88
, APIError = require('./errors/apierror');
@@ -202,8 +202,13 @@ Strategy.prototype.parseErrorResponse = function(body, status) {
202202
return new Error(json.errors[0].message);
203203
}
204204
} catch (ex) {
205-
xml = XML(body)
206-
return new Error(xml.children('error').t() || body);
205+
// Try XML.
206+
try {
207+
xml = XML.parseXml(body);
208+
return new Error(xml.get('error').text() || body);
209+
} catch (ex) {
210+
return new Error(body);
211+
}
207212
}
208213
};
209214

0 commit comments

Comments
 (0)