admin/sync: avoid false positive when no files are distributed
This commit is contained in:
parent
fc902e1063
commit
809d166a2d
1 changed files with 6 additions and 3 deletions
|
@ -10,8 +10,11 @@ import (
|
||||||
"srs.epita.fr/fic-server/libfic"
|
"srs.epita.fr/fic-server/libfic"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SyncExerciceFiles(i Importer, exercice fic.Exercice) []string {
|
func SyncExerciceFiles(i Importer, exercice fic.Exercice) (errs []string) {
|
||||||
var errs []string
|
// If no files directory, don't display error
|
||||||
|
if ! i.exists(path.Join(exercice.Path, "files")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if digs, err := getFileContent(i, path.Join(exercice.Path, "files", "DIGESTS.txt")); err != nil {
|
if digs, err := getFileContent(i, path.Join(exercice.Path, "files", "DIGESTS.txt")); err != nil {
|
||||||
errs = append(errs, fmt.Sprintf("%q: unable to read DIGESTS.txt: %s", path.Base(exercice.Path), err))
|
errs = append(errs, fmt.Sprintf("%q: unable to read DIGESTS.txt: %s", path.Base(exercice.Path), err))
|
||||||
|
@ -75,5 +78,5 @@ func SyncExerciceFiles(i Importer, exercice fic.Exercice) []string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return errs
|
return
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue