sync: Include in file presence checks splitted and compressed files

This commit is contained in:
nemunaire 2023-05-04 13:41:40 +02:00
parent f5529ff72d
commit e261c77c79

View file

@ -80,7 +80,7 @@ func CheckExerciceFilesPresence(i Importer, exercice *fic.Exercice) (files []str
errs = append(errs, berrs...) errs = append(errs, berrs...)
for _, fname := range flist { for _, fname := range flist {
if !i.Exists(path.Join(exercice.Path, "files", fname)) { if !i.Exists(path.Join(exercice.Path, "files", fname)) && !i.Exists(path.Join(exercice.Path, "files", fname+".00")) {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("No such file or directory"))) errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("No such file or directory")))
} else if _, ok := digests[fname]; !ok { } else if _, ok := digests[fname]; !ok {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to import file: No digest given"))) errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to import file: No digest given")))
@ -90,7 +90,7 @@ func CheckExerciceFilesPresence(i Importer, exercice *fic.Exercice) (files []str
} }
for fname := range digests { for fname := range digests {
if !i.Exists(path.Join(exercice.Path, "files", fname)) { if !i.Exists(path.Join(exercice.Path, "files", fname)) && !i.Exists(path.Join(exercice.Path, "files", fname+".gz")) && !i.Exists(path.Join(exercice.Path, "files", fname+".00")) && !i.Exists(path.Join(exercice.Path, "files", fname+".gz.00")) {
errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to read file: No such file or directory. Check your DIGESTS.txt for legacy entries."))) errs = append(errs, NewFileError(exercice, fname, fmt.Errorf("unable to read file: No such file or directory. Check your DIGESTS.txt for legacy entries.")))
} }
} }