Former-commit-id: ebbe370ebbb3b076d945a7e68d60a7e426460914
This commit is contained in:
Henrique Dias
2016-12-29 22:50:36 +00:00
parent 66241b81c2
commit b6a7d78ce6
8 changed files with 202 additions and 394 deletions

View File

@@ -4,6 +4,7 @@ import (
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
@@ -29,6 +30,12 @@ func Download(w http.ResponseWriter, r *http.Request, c *config.Config, i *file.
if len(names) != 0 {
for _, name := range names {
name, err := url.QueryUnescape(name)
if err != nil {
return http.StatusInternalServerError, err
}
files = append(files, filepath.Join(i.Path, name))
}
@@ -78,7 +85,7 @@ func Download(w http.ResponseWriter, r *http.Request, c *config.Config, i *file.
}
name := i.Name()
if name == "" {
if name == "." || name == "" {
name = "download"
}