Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rwky committed Apr 19, 2021
1 parent b020741 commit 26014a1
Show file tree
Hide file tree
Showing 5 changed files with 952 additions and 106 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: "node_js"
node_js:
- "6"
- "8"
- "10"

- "12"
- "14"
- "15"

before_install:
- "npm install [email protected] -g"
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 1.2.0 (2021-04-19)

* Updated NPM deps fixing security issues
* Replaced xtraverse with maintained libxmljs2 thanks to @tomarad jaredhanson/passport-twitter#100
* Updated travis node versions, minimum node version is now 10

# 1.1.0 (2018-06-29)

* Added CHANGELOG.md @rwky
Expand Down
11 changes: 8 additions & 3 deletions lib/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var OAuthStrategy = require('@passport-next/passport-oauth1')
, util = require('util')
, uri = require('url')
, XML = require('xtraverse')
, XML = require('libxmljs2')
, Profile = require('./profile')
, InternalOAuthError = require('@passport-next/passport-oauth1').InternalOAuthError
, APIError = require('./errors/apierror');
Expand Down Expand Up @@ -202,8 +202,13 @@ Strategy.prototype.parseErrorResponse = function(body, status) {
return new Error(json.errors[0].message);
}
} catch (ex) {
xml = XML(body)
return new Error(xml.children('error').t() || body);
// Try XML.
try {
xml = XML.parseXml(body);
return new Error(xml.get('error').text() || body);
} catch (ex) {
return new Error(body);
}
}
};

Expand Down
Loading

0 comments on commit 26014a1

Please sign in to comment.