label flags: Increase allowed size
This commit is contained in:
parent
5dd92a6603
commit
6acc752bd9
@ -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.")))
|
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{
|
f = &fic.FlagLabel{
|
||||||
Order: int8(flagline),
|
Order: int8(flagline),
|
||||||
Label: flag.Label,
|
Label: flag.Label,
|
||||||
@ -171,6 +167,10 @@ func buildKeyFlag(exercice *fic.Exercice, flag ExerciceFlag, flagline int, defau
|
|||||||
}
|
}
|
||||||
flag.Label = prep + flag.Label
|
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)) {
|
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?")))
|
errs = append(errs, NewFlagError(exercice, &flag, flagline, fmt.Errorf("WARNING non-printable characters in flag, is this really expected?")))
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS exercice_flag_labels(
|
|||||||
id_label INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
id_label INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||||
id_exercice INTEGER NOT NULL,
|
id_exercice INTEGER NOT NULL,
|
||||||
ordre TINYINT NOT NULL,
|
ordre TINYINT NOT NULL,
|
||||||
label VARCHAR(255) NOT NULL,
|
label TEXT NOT NULL,
|
||||||
variant VARCHAR(255) NOT NULL,
|
variant VARCHAR(255) NOT NULL,
|
||||||
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
FOREIGN KEY(id_exercice) REFERENCES exercices(id_exercice)
|
||||||
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
) DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
|
||||||
|
Loading…
Reference in New Issue
Block a user