sync: Allow \r at EOL in DIGESTS
This commit is contained in:
parent
910ec94fd8
commit
d89cd2f0ca
@ -28,14 +28,14 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) (errs []string) {
|
|||||||
// Parse DIGESTS.txt
|
// Parse DIGESTS.txt
|
||||||
digests := map[string][]byte{}
|
digests := map[string][]byte{}
|
||||||
for nline, d := range strings.Split(digs, "\n") {
|
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))
|
errs = append(errs, fmt.Sprintf("%q: unable to parse DIGESTS.txt line %d: invalid format", path.Base(exercice.Path), nline + 1))
|
||||||
continue
|
continue
|
||||||
} else if hash, err := hex.DecodeString(dsplt[0]); err != nil {
|
} 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))
|
errs = append(errs, fmt.Sprintf("%q: unable to parse DIGESTS.txt line %d: %s", path.Base(exercice.Path), nline + 1, err))
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
digests[strings.TrimLeftFunc(dsplt[1], unicode.IsSpace)] = hash
|
digests[strings.TrimFunc(dsplt[1], unicode.IsSpace)] = hash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user