label flags: Increase allowed size

This commit is contained in:
nemunaire 2023-07-16 19:00:10 +02:00
parent 5dd92a6603
commit 6acc752bd9
2 changed files with 5 additions and 5 deletions

View File

@ -127,10 +127,6 @@ func buildLabelFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, exc
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("choices cannot be defined.")))
}
if len(flag.Label) > 255 {
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("label is too long (max 255 chars per label).")))
}
f = &fic.FlagLabel{
Order: int8(flagline),
Label: flag.Label,
@ -171,6 +167,10 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
}
flag.Label = prep + flag.Label
if len(flag.Label) > 255 {
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("label is too long (max 255 chars per label).")))
}
if (flag.Type == "text" && !isFullGraphic(strings.Replace(raw, "\n", "", -1))) || (flag.Type != "text" && !isFullGraphic(raw)) {
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("WARNING non-printable characters in flag, is this really expected?")))
}

View File

@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS exercice_flag_labels(
id_label INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_exercice INTEGER NOT NULL,
ordre TINYINT NOT NULL,
label VARCHAR(255) NOT NULL,
label TEXT NOT NULL,
variant VARCHAR(255) NOT NULL,
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;