Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[fix] encode username before checking if it is available otherwise pa…
…ths will be dead
  • Loading branch information
Swaagie committed Dec 15, 2014
1 parent fdc6500 commit 84191d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node.js/lib/client/users.js
Expand Up @@ -30,7 +30,7 @@ util.inherits(Users, Client);
//
Users.prototype.auth = function (callback) {
this.request({ uri: ['auth'] }, function (err, result) {
if (err) return callback(err)
if (err) return callback(err);
callback(err, result);
});
};
Expand All @@ -52,7 +52,7 @@ Users.prototype.create = function (user, callback) {
// Checks the availability of the specified `username`.
//
Users.prototype.available = function (username, callback) {
this.request({ uri: ['users', username, 'available'] }, callback);
this.request({ uri: ['users', encodeURIComponent(username), 'available'] }, callback);
};

//
Expand All @@ -65,7 +65,7 @@ Users.prototype.emailTaken = function (email, callback) {
this.request({ method: 'POST', uri: ['users', 'email', 'taken'], body: {
email: email
}}, callback);
}
};

//
// ### function view (username, callback)
Expand Down

0 comments on commit 84191d3

Please sign in to comment.