Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
Added special use case for port 80 -- since parsing seems to work just fine for all other ports.
  • Loading branch information
danesparza committed Jul 19, 2018
1 parent 038cb56 commit 74246ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,19 @@ class Settings extends Component {
e.preventDefault();

// Format the url
// See https://gist.github.com/jlong/2428561 for more information
// See https://gist.github.com/jlong/2428561 for more information
let parser = document.createElement('a');
parser.href = this.state.AddServerUrl;

let port = parser.port || 8086;
let protocol = parser.protocol || "http:";

// This works flawlessly for everything but port 80 -- so we have a special case for that.
if(this.state.AddServerUrl.substr(this.state.AddServerUrl.length - 3) === ":80")
{
port = 80;
}

let serverUrl = `${protocol}//${parser.hostname}:${port}`;

// Add the server
Expand Down

0 comments on commit 74246ed

Please sign in to comment.