mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-19 21:21:39 +02:00
Don't process dotfiles
This commit makes it so that not only files but also folders which start with a dot are ignored. Fixes #239
This commit is contained in:
committed by
spf13
parent
5581e33a34
commit
f271faea06
@@ -87,12 +87,12 @@ func (f *Filesystem) captureFiles() {
|
||||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
if f.avoid(filePath) {
|
||||
if f.avoid(filePath) || isNonProcessablePath(filePath) {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
if ignoreDotFile(filePath) {
|
||||
if isNonProcessablePath(filePath) {
|
||||
return nil
|
||||
}
|
||||
data, err := ioutil.ReadFile(filePath)
|
||||
@@ -116,7 +116,7 @@ func (f *Filesystem) avoid(filePath string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func ignoreDotFile(filePath string) bool {
|
||||
func isNonProcessablePath(filePath string) bool {
|
||||
base := filepath.Base(filePath)
|
||||
if base[0] == '.' {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user