diff --git a/website/camweb.go b/website/camweb.go index fc67fe74d..1715ebea9 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -321,6 +321,7 @@ func main() { Static: http.StripPrefix("/code/", http.FileServer(http.Dir(*gitwebFiles))), }}) } + mux.HandleFunc("/issue/", issueRedirect) mux.HandleFunc("/", mainHandler) if *buildbotHost != "" && *buildbotBackend != "" { @@ -363,6 +364,17 @@ func main() { log.Fatalf("Serve error: %v", <-errch) } +var issueNum = regexp.MustCompile(`^/issue/(\d+)$`) + +func issueRedirect(w http.ResponseWriter, r *http.Request) { + m := issueNum.FindStringSubmatch(r.URL.Path) + if m == nil { + http.Error(w, "Bad request", 400) + return + } + http.Redirect(w, r, "https://code.google.com/p/camlistore/issues/detail?id=" + m[1], http.StatusFound) +} + type fixUpGitwebUrls struct { handler http.Handler }