diff --git a/http/handler/api/filesystems.go b/http/handler/api/filesystems.go index eb2de22d..21c42aa0 100644 --- a/http/handler/api/filesystems.go +++ b/http/handler/api/filesystems.go @@ -25,7 +25,7 @@ type FSHandler struct { filesystems map[string]FSConfig } -// NewFS return a new FSHanlder type. You have to provide a filesystem to act on. +// NewFS return a new FSHandler type. You have to provide a filesystem to act on. func NewFS(filesystems map[string]FSConfig) *FSHandler { return &FSHandler{ filesystems: filesystems, diff --git a/http/server.go b/http/server.go index e770f247..b0296a60 100644 --- a/http/server.go +++ b/http/server.go @@ -160,6 +160,7 @@ type filesystem struct { fs.FS handler *handler.FSHandler + apihandler *handler.FSHandler middleware echo.MiddlewareFunc } @@ -196,6 +197,8 @@ func NewServer(config Config) (Server, error) { corsPrefixes[httpfs.Mountpoint] = config.Cors.Origins + apihttpfs := httpfs + if config.Cluster != nil { if httpfs.Filesystem.Type() == "disk" || httpfs.Filesystem.Type() == "mem" { httpfs.Filesystem = fs.NewClusterFS(httpfs.Filesystem.Name(), httpfs.Filesystem, config.Cluster.ProxyReader()) @@ -203,8 +206,9 @@ func NewServer(config Config) (Server, error) { } filesystem := &filesystem{ - FS: httpfs, - handler: handler.NewFS(httpfs), + FS: httpfs, + handler: handler.NewFS(httpfs), + apihandler: handler.NewFS(apihttpfs), } if httpfs.Filesystem.Type() == "disk" { @@ -639,7 +643,7 @@ func (s *server) setRoutesV3(v3 *echo.Group) { fshandlers[fs.Name] = api.FSConfig{ Type: fs.Filesystem.Type(), Mountpoint: fs.Mountpoint, - Handler: fs.handler, + Handler: fs.apihandler, } }