Compare commits

..

No commits in common. "ea8ad1d6db9ab054d07fec5d8f932306cb4ee83e" and "ac8f704062a53d4ee41140ffb352be8900709264" have entirely different histories.

3 changed files with 6 additions and 4 deletions

View File

@ -173,9 +173,7 @@ func getExerciceParams(i Importer, exercice *fic.Exercice) (params ExerciceParam
if params, _, err = parseExerciceParams(i, exercice.Path); err != nil {
errs = multierr.Append(errs, NewChallengeTxtError(exercice, 0, err))
} else if len(params.Flags) == 0 && len(params.FlagsUCQ) == 0 && len(params.FlagsMCQ) == 0 {
if !params.WIP {
errs = multierr.Append(errs, NewChallengeTxtError(exercice, 0, fmt.Errorf("has no flag")))
}
errs = multierr.Append(errs, NewChallengeTxtError(exercice, 0, fmt.Errorf("has no flag")))
} else {
// Treat legacy UCQ flags as ExerciceFlag
for _, flag := range params.FlagsUCQ {

View File

@ -60,7 +60,7 @@ func BuildFilesListInto(i Importer, exercice *fic.Exercice, into string) (files
// Parse DIGESTS.txt
if digs, err := GetFileContent(i, path.Join(exercice.Path, into, "DIGESTS.txt")); err != nil {
errs = multierr.Append(errs, NewExerciceError(exercice, fmt.Errorf("unable to read %s: %w", path.Join(into, "DIGESTS.txt"), err)))
} else if len(digs) > 0 {
} else {
digests = map[string][]byte{}
for nline, d := range strings.Split(digs, "\n") {
if dsplt := strings.SplitN(d, " ", 2); len(dsplt) < 2 {

View File

@ -172,6 +172,10 @@ func GetFileContent(i Importer, URI string) (string, error) {
buf = append(buf, b)
}
if len(buf) == 0 {
return "", fmt.Errorf("File is empty")
}
return strings.TrimSpace(string(buf)), nil
}
}