From c462a34d64ec4810a3c8b0b0d0d39389dd4b331c Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Mon, 21 Sep 2026 22:51:21 +0800 Subject: [PATCH] fix: align shared and directory download headers --- chfs-ng/internal/api/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chfs-ng/internal/api/server.go b/chfs-ng/internal/api/server.go index b7b1773..23ff10e 100644 --- a/chfs-ng/internal/api/server.go +++ b/chfs-ng/internal/api/server.go @@ -673,13 +673,14 @@ func (s *Server) shared(w http.ResponseWriter, r *http.Request) { return } 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) if err != nil { http.NotFound(w, r) return } - w.Header().Set("Content-Disposition", `attachment;filename="shared"`) - w.Header().Set("Content-Type", "text/html; charset=utf-8") _, _ = io.WriteString(w, "
\n")
 		for _, item := range items {
 			name := item.Name()
@@ -807,7 +808,6 @@ func (s *Server) downloadDir(w http.ResponseWriter, r *http.Request) {
 		name = "download"
 	}
 	w.Header().Set("Content-Type", "application/zip")
-	w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%q.zip", name))
 	zw := zip.NewWriter(w)
 	defer zw.Close()
 	var walk func(string, string) error