admin/sync: Use globbing for ack handling

This commit is contained in:
nemunaire 2022-10-31 17:21:22 +01:00
parent 5d716106c4
commit 38a4e21e28

View file

@ -22,14 +22,22 @@ func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
ret := CheckExceptions{}
for k, v := range *c {
cols := strings.SplitN(k, ":", 2)
if len(cols) < 2 {
continue
}
for _, path := range paths {
if strings.HasPrefix(k, "*:") || strings.HasPrefix(k, path) {
if strings.HasPrefix(cols[0], path) {
k = strings.TrimPrefix(k, path)
if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(k, "/")
}
ret[k] = v
break
} else if eval, err := filepath.Match(cols[0], path); err == nil && eval {
ret[k] = v
break
}