preprocess: Escape most ASCII punctuation in error messages
This is a minimal version of what we should in principle do here, which is to escape the error message in whatever way is correct for embedding plain text in the surrounding wiki markup language. This implementation approximates that by assuming that HTML entities, alphanumerics and common punctuation characters are passed through the markup language unaltered, but punctuation characters might be misinterpreted. Signed-off-by: Simon McVittie <smcv@debian.org>master
parent
4d355918f0
commit
0e5c8ae806
|
@ -1668,6 +1668,10 @@ sub preprocess ($$$;$$) {
|
||||||
chomp $error;
|
chomp $error;
|
||||||
eval q{use HTML::Entities};
|
eval q{use HTML::Entities};
|
||||||
$error = encode_entities($error);
|
$error = encode_entities($error);
|
||||||
|
# Also encode most ASCII punctuation
|
||||||
|
# as entities so that error messages
|
||||||
|
# are not interpreted as Markdown etc.
|
||||||
|
$error = encode_entities($error, '[](){}!#$%*?@^`|~'."\\");
|
||||||
$ret="[[!$command <span class=\"error\">".
|
$ret="[[!$command <span class=\"error\">".
|
||||||
gettext("Error").": $error"."</span>]]";
|
gettext("Error").": $error"."</span>]]";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue