From: Ruben Date: Thu, 28 Nov 2013 14:27:09 +0000 (+0100) Subject: Fixes #141: Wrong section in multi level structure X-Git-Tag: v0.10~87 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=de670ced86e6df76278a19f19068bbeb46cc5d2f;p=brevno-suite%2Fhugo Fixes #141: Wrong section in multi level structure --- diff --git a/source/filesystem.go b/source/filesystem.go index abec4bad..f44f003f 100644 --- a/source/filesystem.go +++ b/source/filesystem.go @@ -6,6 +6,7 @@ import ( "os" "path" "path/filepath" + "strings" ) type Input interface { @@ -41,8 +42,11 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) { return err } + // section should be the first part of the path dir, logical := path.Split(name) - _, section := path.Split(path.Dir(name)) + parts := strings.Split(dir, "/") + section := parts[0] + if section == "." { section = "" } @@ -54,6 +58,7 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) { Section: section, Dir: dir, }) + return }