diff --git a/admin/sync/exercice_files.go b/admin/sync/exercice_files.go index ee6de6cd..a9689110 100644 --- a/admin/sync/exercice_files.go +++ b/admin/sync/exercice_files.go @@ -28,14 +28,14 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) (errs []string) { // Parse DIGESTS.txt digests := map[string][]byte{} for nline, d := range strings.Split(digs, "\n") { - if dsplt := strings.SplitN(d, " ", 2); len(dsplt) != 2 { + if dsplt := strings.SplitN(d, " ", 2); len(dsplt) < 2 { errs = append(errs, fmt.Sprintf("%q: unable to parse DIGESTS.txt line %d: invalid format", path.Base(exercice.Path), nline + 1)) continue } else if hash, err := hex.DecodeString(dsplt[0]); err != nil { errs = append(errs, fmt.Sprintf("%q: unable to parse DIGESTS.txt line %d: %s", path.Base(exercice.Path), nline + 1, err)) continue } else { - digests[strings.TrimLeftFunc(dsplt[1], unicode.IsSpace)] = hash + digests[strings.TrimFunc(dsplt[1], unicode.IsSpace)] = hash } }