Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing unescape() from self._qs breaks requests with authentication #1619

Closed
andornaut opened this issue Jun 1, 2015 · 4 comments
Closed

Comments

@andornaut
Copy link

GET requests with http basic authentication credentials such as "http://user:pass@example.com" fail with error "self._qs.unescape is not a function".

This error occurs in request.js:

  if (self.uri.auth && !self.hasHeader('authorization')) {
    var uriAuthPieces = self.uri.auth.split(':').map(function(item) {return self._qs.unescape(item)})
    self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true) 
  }

Changing Querystring.prototype.unescape to use the global unescape() or decodeURIComponent appears to resolve this issue.

Environment: Electron 0.27.2 (chrome 43)

@simov
Copy link
Member

simov commented Jun 1, 2015

That might be related to #1600 but tbh I don't see how's that possible. I need more context, can you provide a short code example that reproduces that bug?

@andornaut
Copy link
Author

It seems that the "querystring" library supplied by Browserify does not include querystring.unescape and therefore this assignment doesn't work as expected.

Refs:
browserify/browserify#826
mike-spainhower/querystring#4
Gozala/querystring#6

I'm closing this issue as it does not appear to be caused by a bug in this library.

@sagivo
Copy link

sagivo commented Nov 2, 2017

@andornaut did you find how to fix it on electron? i still get this error

@dotbloup
Copy link

I note that unescape is deprecated: (reference)
consequently self._qs.unescape(item) should be replaced by decodeURI(item)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants