]> Cypherpunks repositories - gostls13.git/commitdiff
godoc/zip.go: fix another zip file system bug
authorRobert Griesemer <gri@golang.org>
Fri, 22 Jul 2011 22:21:50 +0000 (15:21 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 22 Jul 2011 22:21:50 +0000 (15:21 -0700)
Don't report that a directory was found just because we found
the list index where the directory would be if it were there...

R=iant
CC=golang-dev
https://golang.org/cl/4812051

src/cmd/godoc/zip.go

index 28789f8a0b36ccc2d8e9ee5ad32257c9a67e0cac..868aa1f02f02e938bf7d599f6350687647e79089 100644 (file)
@@ -198,5 +198,9 @@ func (z zipList) lookup(name string) (index int, exact bool) {
        if j < 0 {
                return -1, false
        }
-       return i + j, false
+       if strings.HasPrefix(z[j].Name, name) {
+               return i + j, false
+       }
+
+       return -1, false
 }