Start integrating Hugo in the new plugin
Former-commit-id: dcc6bd82b3d3a89637a1032aad1a25d0b1f80046 [formerly 8784cd37bf58e81cdbe1bcec00e6f16b58efc915] [formerly 9e25850e063ae0825de337d5d5f29cee601b9040 [formerly 8b1d36dfb9ebfa001ddeef98034bb5a73d135c94]] Former-commit-id: 04a38bea2d141093570d9289d0d0a056a136fe8a [formerly 5995538504889e698aa6cd35b7da40c38b5d5ddf] Former-commit-id: 8c81a0b060167e1a2983a99bc87b380838ac07dc
This commit is contained in:
14
download.go
14
download.go
@@ -14,17 +14,17 @@ import (
|
||||
|
||||
// downloadHandler creates an archive in one of the supported formats (zip, tar,
|
||||
// tar.gz or tar.bz2) and sends it to be downloaded.
|
||||
func downloadHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
func downloadHandler(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
query := r.URL.Query().Get("format")
|
||||
|
||||
if !c.fi.IsDir {
|
||||
if !c.FI.IsDir {
|
||||
if r.URL.Query().Get("inline") == "true" {
|
||||
w.Header().Set("Content-Disposition", "inline")
|
||||
} else {
|
||||
w.Header().Set("Content-Disposition", "attachment; filename="+c.fi.Name)
|
||||
w.Header().Set("Content-Disposition", "attachment; filename="+c.FI.Name)
|
||||
}
|
||||
|
||||
http.ServeFile(w, r, c.fi.Path)
|
||||
http.ServeFile(w, r, c.FI.Path)
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
@@ -39,11 +39,11 @@ func downloadHandler(c *requestContext, w http.ResponseWriter, r *http.Request)
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
files = append(files, filepath.Join(c.fi.Path, name))
|
||||
files = append(files, filepath.Join(c.FI.Path, name))
|
||||
}
|
||||
|
||||
} else {
|
||||
files = append(files, c.fi.Path)
|
||||
files = append(files, c.FI.Path)
|
||||
}
|
||||
|
||||
if query == "true" {
|
||||
@@ -89,7 +89,7 @@ func downloadHandler(c *requestContext, w http.ResponseWriter, r *http.Request)
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
name := c.fi.Name
|
||||
name := c.FI.Name
|
||||
if name == "." || name == "" {
|
||||
name = "download"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user