aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2024-04-18 08:43:41 +0200
committerGravatar Christian Hesse <mail@eworm.de>2024-04-18 09:04:34 +0200
commit3a36db6de8a69cba493bdd0baf86c60401fe971c (patch)
tree4476deb879745e1a16b7f6c76f2e3114c5dd46a3
parent8c1543a402570278a8dfdcf8d052ab8bb6f282e5 (diff)
mod/notification-matrix: fix double escaping
That was introduced with 2a232ad2f5eef4b60c97306ef731bc5883bf5cfb when switching to :serialize...
-rw-r--r--mod/notification-matrix.rsc28
1 files changed, 11 insertions, 17 deletions
diff --git a/mod/notification-matrix.rsc b/mod/notification-matrix.rsc
index 3e3a33e..86e6b5f 100644
--- a/mod/notification-matrix.rsc
+++ b/mod/notification-matrix.rsc
@@ -86,21 +86,15 @@
}
:local Return "";
- :local Chars {
- "plain"={ "\\"; "\""; "\n" };
- "format"={ "\\"; "\""; "\n"; "&"; "<"; ">" };
- }
- :local Subs {
- "plain"={ "\\\\"; "\\\""; "\\n" };
- "format"={ "\\\\"; "&quot;"; "<br/>"; "&amp;"; "&lt;"; "&gt;" };
- }
+ :local Chars { "\""; "\n"; "&"; "<"; ">" };
+ :local Subs { "&quot;"; "<br/>"; "&amp;"; "&lt;"; "&gt;" };
:for I from=0 to=([ :len $Input ] - 1) do={
:local Char [ :pick $Input $I ];
- :local Replace [ :find ($Chars->$2) $Char ];
+ :local Replace [ :find $Chars $Char ];
:if ([ :typeof $Replace ] = "num") do={
- :set Char ($Subs->$2->$Replace);
+ :set Char ($Subs->$Replace);
}
:set Return ($Return . $Char);
}
@@ -117,17 +111,17 @@
}
:local Headers ({ [ $FetchUserAgentStr ($Notification->"origin") ] });
- :local Plain [ $PrepareText ("## [" . $IdentityExtra . $Identity . "] " . \
- ($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```") "plain" ];
+ :local Plain ("## [" . $IdentityExtra . $Identity . "] " . \
+ ($Notification->"subject") . "\n```\n" . ($Notification->"message") . "\n```");
:local Formatted ("<h2>" . [ $PrepareText ("[" . $IdentityExtra . $Identity . "] " . \
- ($Notification->"subject")) "format" ] . "</h2>" . "<pre><code>" . \
- [ $PrepareText ($Notification->"message") "format" ] . "</code></pre>");
+ ($Notification->"subject")) ] . "</h2>" . "<pre><code>" . \
+ [ $PrepareText ($Notification->"message") ] . "</code></pre>");
:if ([ :len ($Notification->"link") ] > 0) do={
:set Plain ($Plain . "\\n" . [ $SymbolForNotification "link" ] . \
- [ $PrepareText ("[" . $Notification->"link" . "](" . $Notification->"link" . ")") "plain" ]);
+ "[" . $Notification->"link" . "](" . $Notification->"link" . ")");
:set Formatted ($Formatted . "<br/>" . [ $SymbolForNotification "link" ] . \
- "<a href=\\\"" . [ $PrepareText ($Notification->"link") "format" ] . "\\\">" . \
- [ $PrepareText ($Notification->"link") "format" ] . "</a>");
+ "<a href=\"" . [ $PrepareText ($Notification->"link") ] . "\">" . \
+ [ $PrepareText ($Notification->"link") ] . "</a>");
}
:do {