cmd/godoc: redirect /x to subrepo page
Fixes golang/go#9061. Change-Id: Ibe5764932bb8e223e7f838415f84bc330eb5d818 Reviewed-on: https://go-review.googlesource.com/12082 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
543085f0ec
commit
5c915edf62
|
@ -52,6 +52,10 @@ func xHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
if i := strings.Index(head, "/"); i != -1 {
|
if i := strings.Index(head, "/"); i != -1 {
|
||||||
head, tail = head[:i], head[i:]
|
head, tail = head[:i], head[i:]
|
||||||
}
|
}
|
||||||
|
if head == "" {
|
||||||
|
http.Redirect(w, r, "https://godoc.org/-/subrepo", http.StatusTemporaryRedirect)
|
||||||
|
return
|
||||||
|
}
|
||||||
repo, ok := xMap[head]
|
repo, ok := xMap[head]
|
||||||
if !ok {
|
if !ok {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
|
|
Loading…
Reference in New Issue