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:
David Crawshaw 2015-07-12 09:49:48 -04:00
parent 543085f0ec
commit 5c915edf62
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ func xHandler(w http.ResponseWriter, r *http.Request) {
if i := strings.Index(head, "/"); i != -1 {
head, tail = head[:i], head[i:]
}
if head == "" {
http.Redirect(w, r, "https://godoc.org/-/subrepo", http.StatusTemporaryRedirect)
return
}
repo, ok := xMap[head]
if !ok {
http.NotFound(w, r)