diff --git a/cfg/config.go b/cfg/config.go index f5e6251..348d8d9 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -38,12 +38,10 @@ func InitConfig(wd string) bool { if _, err := os.Stat(configJsonPath); os.IsNotExist(err) { log.Println("config.json not found, using default values") - } else { - log.Println("config.json found, overriding default values...") - return readConfig() + return false } - - return true + log.Println("config.json found, overriding default values...") + return readConfig() } func readConfig() bool { diff --git a/fs/data.go b/fs/data.go index 0eb142d..5c88f4a 100644 --- a/fs/data.go +++ b/fs/data.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/bouncepaw/mycorrhiza/cfg" + "github.com/bouncepaw/mycorrhiza/util" ) func (h *Hypha) MetaJsonPath() string { @@ -17,7 +18,7 @@ func (h *Hypha) MetaJsonPath() string { } func (h *Hypha) Path() string { - return filepath.Join(cfg.WikiDir, h.FullName) + return filepath.Join(cfg.WikiDir, util.UrlToCanonical(h.FullName)) } func (h *Hypha) TextPath() string { @@ -25,7 +26,7 @@ func (h *Hypha) TextPath() string { } func (h *Hypha) parentName() string { - return filepath.Dir(h.FullName) + return filepath.Dir(util.UrlToCanonical(h.FullName)) } // hasBinaryData returns true if the revision has any binary data associated. diff --git a/fs/fs.go b/fs/fs.go index b10dc74..3d1488a 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -54,6 +54,3 @@ func (s *Storage) indexHyphae(path string) { } } } - -func (h *Hypha) Close() { -} diff --git a/fs/genealogy.go b/fs/genealogy.go index 1bc3adb..96da25a 100644 --- a/fs/genealogy.go +++ b/fs/genealogy.go @@ -6,6 +6,8 @@ import ( "path/filepath" "sort" "strings" + + "github.com/bouncepaw/mycorrhiza/util" ) func (s *Storage) RenderHypha(h *Hypha) { @@ -24,6 +26,7 @@ type Tree struct { // It can also generate trees for non-existent hyphae, that's why we use `name string` instead of making it a method on `Hypha`. // In `root` is `false`, siblings will not be fetched. func (s *Storage) GetTree(name string, root bool) *Tree { + name = util.UrlToCanonical(name) t := &Tree{Name: name, Root: root} for hyphaName, _ := range s.paths { s.compareNamesAndAppend(t, hyphaName) @@ -65,14 +68,14 @@ func (t *Tree) AsHtml() (html string) { html += `