Skip to content

Commit

Permalink
Don't need http.Dir in Context#File'
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Mar 29, 2016
1 parent dcfb695 commit 70bf482
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"mime"
"mime/multipart"
"net/http"
"os"
"path"
"path/filepath"
"time"
Expand Down Expand Up @@ -365,9 +366,7 @@ func (c *context) XMLBlob(code int, b []byte) (err error) {
}

func (c *context) File(file string) error {
root, file := filepath.Split(file)
fs := http.Dir(root)
f, err := fs.Open(file)
f, err := os.Open(file)
if err != nil {
return ErrNotFound
}
Expand All @@ -376,7 +375,7 @@ func (c *context) File(file string) error {
fi, _ := f.Stat()
if fi.IsDir() {
file = path.Join(file, "index.html")
f, err = fs.Open(file)
f, err = os.Open(file)
if err != nil {
return ErrNotFound
}
Expand Down

0 comments on commit 70bf482

Please sign in to comment.