Updates
Former-commit-id: 35d375188e7c700484d32a27eb48b30192e20537
This commit is contained in:
@@ -19,8 +19,8 @@ import (
|
||||
func Download(w http.ResponseWriter, r *http.Request, c *config.Config, i *file.Info) (int, error) {
|
||||
query := r.URL.Query().Get("download")
|
||||
|
||||
if !i.IsDir() {
|
||||
w.Header().Set("Content-Disposition", "attachment; filename="+i.Name())
|
||||
if !i.IsDir {
|
||||
w.Header().Set("Content-Disposition", "attachment; filename="+i.Name)
|
||||
http.ServeFile(w, r, i.Path)
|
||||
return 0, nil
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func Download(w http.ResponseWriter, r *http.Request, c *config.Config, i *file.
|
||||
return http.StatusInternalServerError, err
|
||||
}
|
||||
|
||||
name := i.Name()
|
||||
name := i.Name
|
||||
if name == "." || name == "" {
|
||||
name = "download"
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Editor struct {
|
||||
func GetEditor(i *file.Info) (*Editor, error) {
|
||||
// Create a new editor variable and set the mode
|
||||
editor := new(Editor)
|
||||
editor.Mode = strings.TrimPrefix(filepath.Ext(i.Name()), ".")
|
||||
editor.Mode = strings.TrimPrefix(filepath.Ext(i.Name), ".")
|
||||
|
||||
switch editor.Mode {
|
||||
case "md", "markdown", "mdown", "mmark":
|
||||
|
||||
@@ -26,7 +26,7 @@ func ServeSingle(w http.ResponseWriter, r *http.Request, c *config.Config, u *co
|
||||
|
||||
p := &page.Page{
|
||||
Info: &page.Info{
|
||||
Name: i.Name(),
|
||||
Name: i.Name,
|
||||
Path: i.VirtualPath,
|
||||
IsDir: false,
|
||||
Data: i,
|
||||
|
||||
Reference in New Issue
Block a user