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

Redirect to GitHub when viewed in the browser #5

Open
tj opened this issue Feb 17, 2020 · 2 comments
Open

Redirect to GitHub when viewed in the browser #5

tj opened this issue Feb 17, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@tj
Copy link
Owner

tj commented Feb 17, 2020

If you happen to click a gobinaries.com link it's not very helpful to download the script, maybe just redirect to GH? Maybe list the repo tags? Something like that

@tj tj added the enhancement New feature or request label Feb 26, 2020
@stephenmathieson
Copy link

I just did this and was confused haha

@codenoid
Copy link

is this okay ?

// need better way to check if user come from browser
if r.Header.Get("Accept-Language") != "" {
	newURL := "https://github.com/"
	uriSegments := strings.Split(path, "/")
	if len(uriSegments) >= 3 {
		// add username
		newURL += uriSegments[1] + "/"
		// add repository id
		newURL += strings.Split(path, "@")[0]
	}
	http.Redirect(w, r, newURL, http.StatusSeeOther)
	return
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants