diff --git a/godoc/redirect/redirect.go b/godoc/redirect/redirect.go index b07d97f19c..c81d05fc95 100644 --- a/godoc/redirect/redirect.go +++ b/godoc/redirect/redirect.go @@ -150,7 +150,7 @@ func Handler(target string) http.Handler { }) } -var validId = regexp.MustCompile(`^[A-Za-z0-9-]*$`) +var validId = regexp.MustCompile(`^[A-Za-z0-9-]*/?$`) func PrefixHandler(prefix, baseURL string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/godoc/redirect/redirect_test.go b/godoc/redirect/redirect_test.go index 5e8045a39c..8a02de32e5 100644 --- a/godoc/redirect/redirect_test.go +++ b/godoc/redirect/redirect_test.go @@ -50,6 +50,9 @@ func TestRedirects(t *testing.T) { "/issues/new": {301, "https://github.com/golang/go/issues/new"}, "/issues/1/2/3": errorResult(404), + "/wiki/foo": {302, "https://github.com/golang/go/wiki/foo"}, + "/wiki/foo/": {302, "https://github.com/golang/go/wiki/foo/"}, + "/design": {301, "https://github.com/golang/proposal/tree/master/design"}, "/design/": {302, "/design"}, "/design/123-foo": {302, "https://github.com/golang/proposal/blob/master/design/123-foo.md"},