db: Add cksum_shown field to files in order to store second checksum in case of gziped content

This commit is contained in:
nemunaire 2022-10-31 18:29:41 +01:00
parent 91b2daea2e
commit 6b7ed273b7
5 changed files with 40 additions and 25 deletions

View file

@ -141,7 +141,13 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExce
for _, fname := range files {
if f, err := i.importFile(path.Join(exercice.Path, "files", fname),
func(filePath string, origin string) (interface{}, error) {
return exercice.ImportFile(filePath, origin, digests[fname])
var digest_shown []byte
if strings.HasSuffix(fname, ".gz") {
if d, exists := digests[strings.TrimSuffix(fname, ".gz")]; exists {
digest_shown = d
}
}
return exercice.ImportFile(filePath, origin, digests[fname], digest_shown)
}); err != nil {
errs = append(errs, NewFileError(exercice, fname, err))
continue