mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(indexers): don't die on failed load of custom-definitions (#303)
* fix(custom-definitions): don't die on failed load
This commit is contained in:
parent
b1d7a1f555
commit
8c720ac23e
1 changed files with 10 additions and 7 deletions
|
@ -396,7 +396,14 @@ func (s *service) LoadCustomIndexerDefinitions() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
outputDirRead, _ := os.Open(s.config.CustomDefinitions)
|
||||
outputDirRead, err := os.Open(s.config.CustomDefinitions)
|
||||
|
||||
if err != nil {
|
||||
s.log.Warn().Stack().Msgf("failed opening custom definitions directory %q: %s", s.config.CustomDefinitions, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
defer outputDirRead.Close()
|
||||
|
||||
//entries, err := fs.ReadDir(Definitions, "definitions")
|
||||
entries, err := outputDirRead.ReadDir(0)
|
||||
|
@ -404,16 +411,12 @@ func (s *service) LoadCustomIndexerDefinitions() error {
|
|||
s.log.Fatal().Stack().Msgf("failed reading directory: %s", err)
|
||||
}
|
||||
|
||||
if len(entries) == 0 {
|
||||
s.log.Fatal().Stack().Msgf("failed reading directory: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
customCount := 0
|
||||
|
||||
for _, f := range entries {
|
||||
fileExtension := filepath.Ext(f.Name())
|
||||
if fileExtension != ".yaml" {
|
||||
if fileExtension != ".yaml" && fileExtension != ".yml" {
|
||||
s.log.Warn().Stack().Msgf("skipping unknown extension definition file: %s", f.Name())
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue