website: redirect /issue/NNN to codesite issue tracker

Change-Id: I323311421bb9d72eb043f3694d78a9bc9931a3d6
This commit is contained in:
Brad Fitzpatrick 2013-02-17 21:40:57 -08:00
parent a44e75435b
commit ef669b8df0
1 changed files with 12 additions and 0 deletions

View File

@ -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
}