add support to download directories as zip, tar, targz and tarbz2 #29

This commit is contained in:
Henrique Dias
2016-10-20 21:55:55 +01:00
parent 63a1a2cd54
commit 3379e6e67c
2 changed files with 55 additions and 0 deletions

View File

@@ -126,6 +126,12 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
// Generate anti security token.
c.GenerateToken()
if fi.IsDir() {
if val, ok := r.URL.Query()["download"]; ok && val[0] != "" {
return fi.DownloadAs(w, val[0])
}
}
if !fi.IsDir() {
query := r.URL.Query()
webdav := false