[tools 1/2] testbot/cgi: Better escape error messages.
Francois Gouget
fgouget at codeweavers.com
Wed Mar 2 10:02:30 CST 2022
This allows using newlines and quotes in error messages.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/lib/WineTestBot/CGI/PageBase.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm
index 121e09aabd..5f61466908 100644
--- a/testbot/lib/WineTestBot/CGI/PageBase.pm
+++ b/testbot/lib/WineTestBot/CGI/PageBase.pm
@@ -360,8 +360,10 @@ sub GenerateErrorPopup($$)
{
print "<script type='text/javascript'>\n";
print "<!--\n";
- $ErrMessage =~ s/'/\\'/g;
- print "function ShowError() { alert('", $ErrMessage, "'); }\n";
+ $ErrMessage =~ s~\\~\\\\~g;
+ $ErrMessage =~ s~"~\\\"~g;
+ $ErrMessage =~ s~\n~\\n~g;
+ print "function ShowError() { alert(\"$ErrMessage\"); }\n";
my $ErrField = $Page->GetErrField();
if ($ErrField)
{
--
2.30.2
More information about the wine-devel
mailing list