diff --git a/cmd/filemanager/main.go b/cmd/filemanager/main.go index 72b06536..bce11788 100644 --- a/cmd/filemanager/main.go +++ b/cmd/filemanager/main.go @@ -188,6 +188,7 @@ func handler() http.Handler { Rules: []*filemanager.Rule{}, Locale: viper.GetString("Locale"), CSS: "", + Scope: viper.GetString("Scope"), FileSystem: fileutils.Dir(viper.GetString("Scope")), }, Store: &filemanager.Store{ @@ -195,6 +196,9 @@ func handler() http.Handler { Users: bolt.UsersStore{DB: db}, Share: bolt.ShareStore{DB: db}, }, + NewFS: func(scope string) filemanager.FileSystem { + return fileutils.Dir(scope) + }, } err = fm.Load() diff --git a/staticgen/hugo.go b/staticgen/hugo.go index 93f8a7c7..4a12ea77 100644 --- a/staticgen/hugo.go +++ b/staticgen/hugo.go @@ -84,7 +84,7 @@ func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, return http.StatusForbidden, nil } - filename := filepath.Join(string(c.User.FileSystem), r.URL.Path) + filename := filepath.Join(c.User.Scope, r.URL.Path) archetype := r.Header.Get("archetype") ext := filepath.Ext(filename) @@ -108,7 +108,7 @@ func (h Hugo) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, // Publish publishes a post. func (h Hugo) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) { - filename := filepath.Join(string(c.User.FileSystem), r.URL.Path) + filename := filepath.Join(c.User.Scope, r.URL.Path) // We only run undraft command if it is a file. if strings.HasSuffix(filename, ".md") && strings.HasSuffix(filename, ".markdown") { diff --git a/staticgen/jekyll.go b/staticgen/jekyll.go index 4c160458..fea4dd1a 100644 --- a/staticgen/jekyll.go +++ b/staticgen/jekyll.go @@ -45,7 +45,7 @@ func (j Jekyll) Hook(c *fm.Context, w http.ResponseWriter, r *http.Request) (int // Publish publishes a post. func (j Jekyll) Publish(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) { - filename := filepath.Join(string(c.User.FileSystem), r.URL.Path) + filename := filepath.Join(c.User.Scope, r.URL.Path) // We only run undraft command if it is a file. if err := j.undraft(filename); err != nil {