Skip to content

Commit

Permalink
fix(index): fix the issue where ignored paths are not updated (#7907)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lanfei authored Feb 9, 2025
1 parent d983a4e commit 0219c4e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/search/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func WriteProgress(progress *model.IndexProgress) {
}
}

func updateIgnorePaths() {
func updateIgnorePaths(customIgnorePaths string) {
storages := op.GetAllStorages()
ignorePaths := make([]string, 0)
var skipDrivers = []string{"AList V2", "AList V3", "Virtual"}
Expand Down Expand Up @@ -66,7 +66,6 @@ func updateIgnorePaths() {
}
}
}
customIgnorePaths := setting.GetStr(conf.IgnorePaths)
if customIgnorePaths != "" {
ignorePaths = append(ignorePaths, strings.Split(customIgnorePaths, "\n")...)
}
Expand All @@ -84,13 +83,13 @@ func isIgnorePath(path string) bool {

func init() {
op.RegisterSettingItemHook(conf.IgnorePaths, func(item *model.SettingItem) error {
updateIgnorePaths()
updateIgnorePaths(item.Value)
return nil
})
op.RegisterStorageHook(func(typ string, storage driver.Driver) {
var skipDrivers = []string{"AList V2", "AList V3", "Virtual"}
if utils.SliceContains(skipDrivers, storage.Config().Name) {
updateIgnorePaths()
updateIgnorePaths(setting.GetStr(conf.IgnorePaths))
}
})
}

0 comments on commit 0219c4e

Please sign in to comment.