mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Add some tests for IgnoreFiles
And log error on invalid regexp. See #1189
This commit is contained in:
parent
beaa1b3aad
commit
beeae6ab69
3 changed files with 33 additions and 18 deletions
|
@ -151,8 +151,11 @@ func isNonProcessablePath(filePath string) bool {
|
|||
ignoreFiles := viper.GetStringSlice("IgnoreFiles")
|
||||
if len(ignoreFiles) > 0 {
|
||||
for _, ignorePattern := range ignoreFiles {
|
||||
match, _ := regexp.MatchString(ignorePattern, filePath)
|
||||
if match {
|
||||
match, err := regexp.MatchString(ignorePattern, filePath)
|
||||
if err != nil {
|
||||
helpers.DistinctErrorLog.Printf("Invalid regexp '%s' in ignoreFiles: %s", ignorePattern, err)
|
||||
return false
|
||||
} else if match {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue