diff --git a/chfs-ng/internal/api/server.go b/chfs-ng/internal/api/server.go index a53cc3a..c2faa7a 100644 --- a/chfs-ng/internal/api/server.go +++ b/chfs-ng/internal/api/server.go @@ -564,6 +564,10 @@ func (s *Server) shared(w http.ResponseWriter, r *http.Request) { _, _ = io.WriteString(w, "\n") return } + if r.Method != http.MethodGet { + http.NotFound(w, r) + return + } f, err := s.Store.Open(p) if err != nil { http.NotFound(w, r) @@ -611,20 +615,7 @@ func (s *Server) preview(w http.ResponseWriter, r *http.Request) { } func (s *Server) fileHandler(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/" || strings.HasPrefix(r.URL.Path, "/asset/") { - http.NotFound(w, r) - return - } - if strings.HasPrefix(r.URL.Path, "/chfs/") || r.URL.Path == "/webdav" { - http.NotFound(w, r) - return - } - p := strings.Trim(strings.ReplaceAll(r.URL.Path, "\\", "/"), "/") - if p == "" { - http.NotFound(w, r) - return - } - s.serveFile(w, r, p, false) + http.NotFound(w, r) } func (s *Server) serveFile(w http.ResponseWriter, r *http.Request, p string, attachment bool) {