mirror of
https://github.com/chromium/crashpad.git
synced 2024-12-26 23:01:05 +08:00
Add /bug redirects to the home page AppEngine app
/bug/ redirects to the Crashpad project on Monorail. /bug/new redirects to the “new issue” screen, and /bug/123 redirects to the named bug. R=andybons@chromium.org Review URL: https://codereview.chromium.org/1415063002 .
This commit is contained in:
parent
6c0d42ce9d
commit
0ed0106aa4
@ -31,13 +31,16 @@ import (
|
||||
"google.golang.org/appengine/urlfetch"
|
||||
)
|
||||
|
||||
const baseURL = "https://chromium.googlesource.com/crashpad/crashpad/+/doc/doc/generated/?format=TEXT"
|
||||
|
||||
func init() {
|
||||
http.HandleFunc("/", handler)
|
||||
}
|
||||
|
||||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
const (
|
||||
baseURL = "https://chromium.googlesource.com/crashpad/crashpad/+/doc/doc/generated/?format=TEXT"
|
||||
bugBaseURL = "https://bugs.chromium.org/p/crashpad/"
|
||||
)
|
||||
|
||||
ctx := appengine.NewContext(r)
|
||||
client := urlfetch.Client(ctx)
|
||||
|
||||
@ -47,6 +50,17 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if r.URL.Path == "/bug" || r.URL.Path == "/bug/" {
|
||||
http.Redirect(w, r, bugBaseURL, http.StatusFound)
|
||||
return
|
||||
} else if r.URL.Path == "/bug/new" {
|
||||
http.Redirect(w, r, bugBaseURL+"issues/entry", http.StatusFound)
|
||||
return
|
||||
} else if strings.HasPrefix(r.URL.Path, "/bug/") {
|
||||
http.Redirect(w, r, bugBaseURL+"issues/detail?id="+r.URL.Path[5:], http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
u, err := url.Parse(baseURL)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Loading…
x
Reference in New Issue
Block a user