fix(index): fix the issue where ignored paths are not updated (#7907)

pull/7976/head
Jealous 2025-02-09 18:31:43 +08:00 committed by GitHub
parent d983a4ebcb
commit 0219c4e15a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 4 deletions

View File

@ -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"}
@ -66,7 +66,6 @@ func updateIgnorePaths() {
}
}
}
customIgnorePaths := setting.GetStr(conf.IgnorePaths)
if customIgnorePaths != "" {
ignorePaths = append(ignorePaths, strings.Split(customIgnorePaths, "\n")...)
}
@ -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))
}
})
}