admin/sync: Keep Exceptions from multiple files

This commit is contained in:
nemunaire 2022-10-31 16:38:32 +01:00
parent ac25202024
commit 23ac512ce6
4 changed files with 16 additions and 13 deletions

View file

@ -14,7 +14,7 @@ func (c *CheckExceptions) GetExerciceExceptions(e *fic.Exercice) *CheckException
return c.GetFileExceptions(filepath.Base(e.Path))
}
func (c *CheckExceptions) GetFileExceptions(path string) *CheckExceptions {
func (c *CheckExceptions) GetFileExceptions(paths ...string) *CheckExceptions {
if c == nil {
return nil
}
@ -22,14 +22,17 @@ func (c *CheckExceptions) GetFileExceptions(path string) *CheckExceptions {
ret := CheckExceptions{}
for k, v := range *c {
if strings.HasPrefix(k, "*:") || strings.HasPrefix(k, path) {
k = strings.TrimPrefix(k, path)
for _, path := range paths {
if strings.HasPrefix(k, "*:") || strings.HasPrefix(k, path) {
k = strings.TrimPrefix(k, path)
if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(k, "/")
if strings.HasPrefix(k, "/") {
k = strings.TrimPrefix(k, "/")
}
ret[k] = v
break
}
ret[k] = v
}
}