Skip to content

Commit

Permalink
Merge pull request #14 from moul/fix-13
Browse files Browse the repository at this point in the history
Fix panic when running on older GoTTY server (#13)
  • Loading branch information
moul committed Oct 10, 2015
2 parents 76be79f + 97da70d commit 7ff8568
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Mon Aug 24 18:54:38 CEST 2015

### master (unreleased)

* Fix panic when running on older GoTTY server ([#13](https://github.com/moul/gotty-client/issues/13))
* Add 'homebrew support' ([#1](https://github.com/moul/gotty-client/issues/1))
* Add Changelog ([#5](https://github.com/moul/gotty-client/issues/5))
* Add GOXC configuration to build binaries for multiple architectures ([#2](https://github.com/moul/gotty-client/issues/2))
Expand Down
7 changes: 6 additions & 1 deletion gotty-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ func (c *Client) GetAuthToken() (string, error) {
}

re := regexp.MustCompile("var gotty_auth_token = '(.*)'")
return re.FindStringSubmatch(string(body))[1], nil
output := re.FindStringSubmatch(string(body))
if len(output) == 0 {
return "", fmt.Errorf("Cannot fetch GoTTY auth-token, please upgrade your GoTTY server.")
}

return output[1], nil
}

// Connect tries to dial a websocket server
Expand Down

0 comments on commit 7ff8568

Please sign in to comment.