]> Cypherpunks repositories - gostls13.git/commit
net/http: handle absolute paths in mapDirOpenError
authorNathan Caza <mastercactapus@gmail.com>
Sat, 11 Feb 2017 03:09:21 +0000 (21:09 -0600)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 14 Feb 2017 04:41:36 +0000 (04:41 +0000)
commita610957f2e48c5b917126b1d0b5f930f05ca8841
tree950be7345177835059d340d1ecc6dd9ea74bcd34
parentef30a1c8aa68f5226de1ed7397751f15f2956d62
net/http: handle absolute paths in mapDirOpenError

The current implementation does not account for Dir being
initialized with an absolute path on systems that start
paths with filepath.Separator. In this scenario, the
original error is returned, and not checked for file
segments.

This change adds a test for this case, and corrects the
behavior by ignoring blank path segments in the loop.

Refs #18984

Change-Id: I9b79fd0a73a46976c8e2feda0283ef0bb2b62ea1
Reviewed-on: https://go-review.googlesource.com/36804
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/fs.go
src/net/http/fs_test.go