Commit 7e9f00c8 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/godoc: fix buggy use of strings.HasSuffix

This code never worked. Maybe it's not necessary?

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7225070
parent f5154edc
......@@ -652,7 +652,7 @@ func applyTemplate(t *template.Template, name string, data interface{}) []byte {
func redirect(w http.ResponseWriter, r *http.Request) (redirected bool) {
canonical := pathpkg.Clean(r.URL.Path)
if !strings.HasSuffix("/", canonical) {
if !strings.HasSuffix(canonical, "/") {
canonical += "/"
}
if r.URL.Path != canonical {
......@@ -666,9 +666,7 @@ func redirect(w http.ResponseWriter, r *http.Request) (redirected bool) {
func redirectFile(w http.ResponseWriter, r *http.Request) (redirected bool) {
c := pathpkg.Clean(r.URL.Path)
for strings.HasSuffix("/", c) {
c = c[:len(c)-1]
}
c = strings.TrimRight(c, "/")
if r.URL.Path != c {
url := *r.URL
url.Path = c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment