mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-17 00:57:53 +00:00
Do not return empty theme dirs
This prevents reading data etc. from the root. Fixes #2320
This commit is contained in:
parent
4ddd5361c1
commit
5f5fccbc36
1 changed files with 8 additions and 6 deletions
|
@ -183,13 +183,15 @@ func GetThemeDataDirPath() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func getThemeDirPath(path string) (string, error) {
|
func getThemeDirPath(path string) (string, error) {
|
||||||
var themeDir string
|
if !ThemeSet() {
|
||||||
if ThemeSet() {
|
return "", errors.New("No theme set")
|
||||||
themeDir = filepath.Join(GetThemeDir(), path)
|
|
||||||
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
|
|
||||||
return "", fmt.Errorf("Unable to find %s directory for theme %s in %s", path, viper.GetString("theme"), themeDir)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
themeDir := filepath.Join(GetThemeDir(), path)
|
||||||
|
if _, err := os.Stat(themeDir); os.IsNotExist(err) {
|
||||||
|
return "", fmt.Errorf("Unable to find %s directory for theme %s in %s", path, viper.GetString("theme"), themeDir)
|
||||||
|
}
|
||||||
|
|
||||||
return themeDir, nil
|
return themeDir, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue