소스 검색

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.
pull/89/head
Matt Baer 5 년 전
부모
커밋
3d30a09695
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  1. +1
    -2
      author/author.go

+ 1
- 2
author/author.go 파일 보기

@@ -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
})


불러오는 중...
취소
저장