This commit is contained in:
Henrique Dias committed 2016-06-11 23:01:24 +01:00
1 parent 8c24409f33
commit bfcf135f7a
6 files changed
+253 -307

No files matched your search

+9 -12
View File
@@ -64,19 +64,16 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
return ServeAssets(w, r, c)
}
if fi.IsDir {
//return f.ServeListing(w, r, file.File, c)
return http.StatusNotImplemented, nil
}
if !fi.IsDir {
query := r.URL.Query()
if val, ok := query["raw"]; ok && val[0] == "true" {
return f.Next.ServeHTTP(w, r)
}
query := r.URL.Query()
if val, ok := query["raw"]; ok && val[0] == "true" {
return f.Next.ServeHTTP(w, r)
}
if val, ok := query["download"]; ok && val[0] == "true" {
w.Header().Set("Content-Disposition", "attachment; filename="+fi.Name)
return f.Next.ServeHTTP(w, r)
if val, ok := query["download"]; ok && val[0] == "true" {
w.Header().Set("Content-Disposition", "attachment; filename="+fi.Name)
return f.Next.ServeHTTP(w, r)
}
}
return fi.ServeAsHTML(w, r, c)