Chromium Code Reviews| Index: doc/appengine/main.go |
| diff --git a/doc/appengine/main.go b/doc/appengine/main.go |
| index 261440d418f5e24389b49f4d3601cf95a2d87968..354d4b832d9357ce003db600f7a0c2d60853beca 100644 |
| --- a/doc/appengine/main.go |
| +++ b/doc/appengine/main.go |
| @@ -31,13 +31,14 @@ 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" |
|
Bons
2015/10/21 01:50:03
this can be
const (
baseURL = ...
bugBaseURL
Mark Mentovai
2015/10/21 01:53:41
Bons wrote:
|
| + const bugBaseURL = "https://bugs.chromium.org/p/crashpad/" |
| + |
| ctx := appengine.NewContext(r) |
| client := urlfetch.Client(ctx) |
| @@ -47,6 +48,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) |