Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2104)

Unified Diff: doc/appengine/main.go

Issue 1415063002: Add /bug redirects to the home page AppEngine app (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: doc/appengine/main.go
diff --git a/doc/appengine/main.go b/doc/appengine/main.go
index 261440d418f5e24389b49f4d3601cf95a2d87968..e05870f5b2eeaed800f4ba9c4351de2a231a4871 100644
--- a/doc/appengine/main.go
+++ b/doc/appengine/main.go
@@ -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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698