mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2024-05-11 05:55:19 +00:00
mod/notification-matrix: fix double escaping
That was introduced with 2a232ad2f5
when
switching to :serialize...
This commit is contained in:
@ -86,21 +86,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:local Return "";
|
:local Return "";
|
||||||
:local Chars {
|
:local Chars { "\""; "\n"; "&"; "<"; ">" };
|
||||||
"plain"={ "\\"; "\""; "\n" };
|
:local Subs { """; "<br/>"; "&"; "<"; ">" };
|
||||||
"format"={ "\\"; "\""; "\n"; "&"; "<"; ">" };
|
|
||||||
}
|
|
||||||
:local Subs {
|
|
||||||
"plain"={ "\\\\"; "\\\""; "\\n" };
|
|
||||||
"format"={ "\\\\"; """; "<br/>"; "&"; "<"; ">" };
|
|
||||||
}
|
|
||||||
|
|
||||||
:for I from=0 to=([ :len $Input ] - 1) do={
|
:for I from=0 to=([ :len $Input ] - 1) do={
|
||||||
:local Char [ :pick $Input $I ];
|
:local Char [ :pick $Input $I ];
|
||||||
:local Replace [ :find ($Chars->$2) $Char ];
|
:local Replace [ :find $Chars $Char ];
|
||||||
|
|
||||||
:if ([ :typeof $Replace ] = "num") do={
|
:if ([ :typeof $Replace ] = "num") do={
|
||||||
:set Char ($Subs->$2->$Replace);
|
:set Char ($Subs->$Replace);
|
||||||
}
|
}
|
||||||
:set Return ($Return . $Char);
|
:set Return ($Return . $Char);
|
||||||
}
|
}
|
||||||
@ -117,17 +111,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ] });
|
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ] });
|
||||||
:local Plain [ $PrepareText ("## [" . $IdentityExtra . $Identity . "] " . \
|
:local Plain ("## [" . $IdentityExtra . $Identity . "] " . \
|
||||||
($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```") "plain" ];
|
($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```");
|
||||||
:local Formatted ("<h2>" . [ $PrepareText ("[" . $IdentityExtra . $Identity . "] " . \
|
:local Formatted ("<h2>" . [ $PrepareText ("[" . $IdentityExtra . $Identity . "] " . \
|
||||||
($Notification->"subject")) "format" ] . "</h2>" . "<pre><code>" . \
|
($Notification->"subject")) ] . "</h2>" . "<pre><code>" . \
|
||||||
[ $PrepareText ($Notification->"message") "format" ] . "</code></pre>");
|
[ $PrepareText ($Notification->"message") ] . "</code></pre>");
|
||||||
:if ([ :len ($Notification->"link") ] > 0) do={
|
:if ([ :len ($Notification->"link") ] > 0) do={
|
||||||
:set Plain ($Plain . "\\n" . [ $SymbolForNotification "link" ] . \
|
:set Plain ($Plain . "\\n" . [ $SymbolForNotification "link" ] . \
|
||||||
[ $PrepareText ("[" . $Notification->"link" . "](" . $Notification->"link" . ")") "plain" ]);
|
"[" . $Notification->"link" . "](" . $Notification->"link" . ")");
|
||||||
:set Formatted ($Formatted . "<br/>" . [ $SymbolForNotification "link" ] . \
|
:set Formatted ($Formatted . "<br/>" . [ $SymbolForNotification "link" ] . \
|
||||||
"<a href=\\\"" . [ $PrepareText ($Notification->"link") "format" ] . "\\\">" . \
|
"<a href=\"" . [ $PrepareText ($Notification->"link") ] . "\">" . \
|
||||||
[ $PrepareText ($Notification->"link") "format" ] . "</a>");
|
[ $PrepareText ($Notification->"link") ] . "</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
:do {
|
:do {
|
||||||
|
Reference in New Issue
Block a user