1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:44:45 -07:00

godoc/redirect: if id in /cl/{id} is less than 150k, treat as Gerrit CL id

Change-Id: Id69c00d908d18151486007ec03da5495b34b05f5
Reviewed-on: https://go-review.googlesource.com/1223
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Shenghou Ma 2014-12-09 01:22:46 -05:00 committed by Andrew Gerrand
parent d7df296309
commit 6e0e92af7e

View File

@ -10,6 +10,7 @@ package redirect
import (
"net/http"
"regexp"
"strconv"
"strings"
)
@ -183,7 +184,9 @@ func clHandler(w http.ResponseWriter, r *http.Request) {
return
}
target := ""
if strings.HasPrefix(id, "I") {
// the first CL in rietveld is about 152046, so if id is less than
// 150000, treat it as a Gerrit change id.
if n, _ := strconv.Atoi(id); strings.HasPrefix(id, "I") || n < 150000 {
target = "https://go-review.googlesource.com/#/q/" + id
} else {
target = "https://codereview.appspot.com/" + id