mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 03:20:17 +00:00
Fix IsValidUsername check when PagesParentDir isn't current dir
Previously, this check would only work if there was a pages/ dir in the current working directory. Now it respects the pages_parent_dir configuration setting.
This commit is contained in:
parent
372b4e5dcd
commit
3d30a09695
1 changed files with 1 additions and 2 deletions
|
@ -112,8 +112,7 @@ func IsValidUsername(cfg *config.Config, username string) bool {
|
|||
// Username is invalid if page with the same name exists. So traverse
|
||||
// available pages, adding them to reservedUsernames map that'll be checked
|
||||
// later.
|
||||
// TODO: use pagesDir const
|
||||
filepath.Walk("pages/", func(path string, i os.FileInfo, err error) error {
|
||||
filepath.Walk(filepath.Join(cfg.Server.PagesParentDir, "pages"), func(path string, i os.FileInfo, err error) error {
|
||||
reservedUsernames[i.Name()] = true
|
||||
return nil
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue