Correctly escape strings if needed and check for it

This commit is contained in:
2024-10-16 16:51:39 +02:00
parent c200d5bf73
commit f27116930a
4 changed files with 26 additions and 1 deletions

View File

@@ -15,6 +15,10 @@ func (p *PlainText) Check() error {
return errors.New("type attribute of plain text must be text or html if not omitted")
}
if p.Type == "html" && !isCorrectlyEscaped(p.Text) {
return errors.New("text element of plain text not correctly escaped")
}
if p.Text == "" {
return errors.New("text element of plain text empty")
}