sync: fix hash computation by factorizing

This commit is contained in:
nemunaire 2019-10-12 13:37:24 +02:00
parent 0766fbe480
commit 97a3aa713f
3 changed files with 32 additions and 36 deletions

View file

@ -110,7 +110,11 @@ func buildKeyFlag(exercice fic.Exercice, flag ExerciceFlag, flagline int, defaul
errs = append(errs, fmt.Sprintf("%q: WARNING flag #%d: non-printable characters in flag, is this really expected?", path.Base(exercice.Path), flagline))
}
hashedFlag := fic.ComputeHashedFlag([]byte(raw))
hashedFlag, err := fic.ComputeHashedFlag([]byte(raw), !flag.CaseSensitive, validatorRegexp(flag.ValidatorRe))
if err != nil {
errs = append(errs, err.Error())
return
}
fl := fic.Flag(fic.FlagKey{
IdExercice: exercice.Id,
Label: flag.Label,