An error on opening .stignore will satisfy os.IsNotExist() and not be reported. Other errors will be reported and stop the folder, including is-not-exist errors from #include as these are passed through fmt.Errorf. Also fixes minor issue where we would not print cause of folder stopping to the log. Also fixes minor issue with capitalization of errors.
This commit is contained in:
@@ -1183,7 +1183,9 @@ func (m *Model) AddFolder(cfg config.FolderConfiguration) {
|
||||
}
|
||||
|
||||
ignores := ignore.New(m.cacheIgnoredFiles)
|
||||
_ = ignores.Load(filepath.Join(cfg.Path(), ".stignore")) // Ignore error, there might not be an .stignore
|
||||
if err := ignores.Load(filepath.Join(cfg.Path(), ".stignore")); err != nil && !os.IsNotExist(err) {
|
||||
l.Warnln("Loading ignores:", err)
|
||||
}
|
||||
m.folderIgnores[cfg.ID] = ignores
|
||||
|
||||
m.fmut.Unlock()
|
||||
@@ -1270,10 +1272,17 @@ func (m *Model) internalScanFolderSubs(folder string, subs []string) error {
|
||||
}
|
||||
|
||||
if err := m.CheckFolderHealth(folder); err != nil {
|
||||
runner.setError(err)
|
||||
l.Infof("Stopping folder %s due to error: %s", folder, err)
|
||||
return err
|
||||
}
|
||||
|
||||
_ = ignores.Load(filepath.Join(folderCfg.Path(), ".stignore")) // Ignore error, there might not be an .stignore
|
||||
if err := ignores.Load(filepath.Join(folderCfg.Path(), ".stignore")); err != nil && !os.IsNotExist(err) {
|
||||
err = fmt.Errorf("loading ignores: %v", err)
|
||||
runner.setError(err)
|
||||
l.Infof("Stopping folder %s due to error: %s", folder, err)
|
||||
return err
|
||||
}
|
||||
|
||||
// Required to make sure that we start indexing at a directory we're already
|
||||
// aware off.
|
||||
|
||||
Reference in New Issue
Block a user