admin/sync: Keep Exceptions from multiple files
This commit is contained in:
parent
ac25202024
commit
23ac512ce6
4 changed files with 16 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue