1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-24 08:22:21 +02:00

Merge remote-tracking branch 'origin/master' into rice

This commit is contained in:
Carlos Alexandro Becker 2015-10-17 21:59:57 -03:00
commit dfae5e676a
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ import (
"encoding/json"
"encoding/xml"
"net/http"
spath "path"
"path/filepath"
"fmt"
@ -198,7 +198,7 @@ func (c *Context) XML(code int, i interface{}) (err error) {
// to true, the client is prompted to save the file with provided `name`,
// name can be empty, in that case name of the file is used.
func (c *Context) File(path, name string, attachment bool) (err error) {
dir, file := spath.Split(path)
dir, file := filepath.Split(path)
if attachment {
c.response.Header().Set(ContentDisposition, "attachment; filename="+name)
}

View File

@ -394,6 +394,7 @@ func serveFile(dir, file string, c *Context) error {
if err != nil {
return NewHTTPError(http.StatusNotFound)
}
defer f.Close()
fi, _ := f.Stat()
if fi.IsDir() {