Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #229 from bookchin/bug/trailing-space-uri
Browse files Browse the repository at this point in the history
v1.3.5 (fix whitespace issue in url when opening a datachannel)
  • Loading branch information
bookchin committed Jun 29, 2016
2 parents 511adae + e4698f0 commit 9c59fbc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/datachannel/client.js
Expand Up @@ -160,7 +160,7 @@ DataChannelClient.getChannelURL = function(contact) {
return url.format({
protocol: 'ws',
slashes: true,
hostname: contact.address,
hostname: contact.address.trim(),
port: contact.port
});
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "storj",
"version": "1.3.4",
"version": "1.3.5",
"description": "implementation of the storj protocol for node.js and the browser",
"main": "index.js",
"directories": {
Expand Down
11 changes: 11 additions & 0 deletions test/datachannel/client.unit.js
Expand Up @@ -163,3 +163,14 @@ describe('DataChannelClient', function() {
});

});

describe('DataChannelClient#getChannelURL', function() {

it('should create url and trim whitespace from address', function() {
expect(DataChannelClient.getChannelURL({
address: ' 127.0.0.1 ',
port: 1337
})).to.equal('ws://127.0.0.1:1337');
});

});

0 comments on commit 9c59fbc

Please sign in to comment.