fix: align shared and directory download headers
This commit is contained in:
@@ -673,13 +673,14 @@ func (s *Server) shared(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if fi.IsDir() {
|
if fi.IsDir() {
|
||||||
|
w.Header().Set("Content-Disposition", `attachment;filename="shared"`)
|
||||||
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||||
|
w.Header().Set("Last-Modified", fi.ModTime().UTC().Format(http.TimeFormat))
|
||||||
items, err := s.Store.List(p)
|
items, err := s.Store.List(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.NotFound(w, r)
|
http.NotFound(w, r)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Disposition", `attachment;filename="shared"`)
|
|
||||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
||||||
_, _ = io.WriteString(w, "<pre>\n")
|
_, _ = io.WriteString(w, "<pre>\n")
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
name := item.Name()
|
name := item.Name()
|
||||||
@@ -807,7 +808,6 @@ func (s *Server) downloadDir(w http.ResponseWriter, r *http.Request) {
|
|||||||
name = "download"
|
name = "download"
|
||||||
}
|
}
|
||||||
w.Header().Set("Content-Type", "application/zip")
|
w.Header().Set("Content-Type", "application/zip")
|
||||||
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%q.zip", name))
|
|
||||||
zw := zip.NewWriter(w)
|
zw := zip.NewWriter(w)
|
||||||
defer zw.Close()
|
defer zw.Close()
|
||||||
var walk func(string, string) error
|
var walk func(string, string) error
|
||||||
|
|||||||
Reference in New Issue
Block a user