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

Fix panic when running on older GoTTY server (#13) #14

Merged
merged 1 commit into from
Oct 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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