summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-04-24 09:07:50 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-04-24 09:07:50 +0200
commitd7beb4e395ef15481a543ef8f9a6b91be000782c (patch)
tree68b5a876dd16b18875378d0fc251e5d4eeceedf4
parentdf8d80b50cc092a27a92b37b5b1709c58d883d53 (diff)
remove arbitrary HTML tags from HAFAS HIMMessage attribute content4.0.2
-rw-r--r--lib/DBInfoscreen/Helper/HAFAS.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm
index 0a98e73..84e42c3 100644
--- a/lib/DBInfoscreen/Helper/HAFAS.pm
+++ b/lib/DBInfoscreen/Helper/HAFAS.pm
@@ -126,9 +126,18 @@ sub get_xml_p {
$body
=~ s{<Attribute([^>]+)text="([^"]*)"([^"=]*)""}{<Attribute$1text="$2&#042;$3&#042;"}s;
- # Dito for <HIMMessage [...] lead="[...]<br>[...]">.
+ # Dito for <HIMMessage [...] lead="[...]<br>[...]">
+ # (replace line breaks with space)
while ( $body
- =~ s{<HIMMessage([^>]+)lead="([^"]*)<br/?>([^"=]*)"}{<HIMMessage$1lead="$2 $3"}gs
+ =~ s{<HIMMessage([^>]+)lead="([^"]*)<br/?>([^"=]*)"}{<HIMMessage$1lead="$2 $3"}gis
+ )
+ {
+ }
+
+ # ... and any other HTML tag inside an XML attribute
+ # (remove them entirely)
+ while ( $body
+ =~ s{<HIMMessage([^>]+)lead="([^"]*)<[^>]+>([^"=]*)"}{<HIMMessage$1lead="$2$3"}gis
)
{
}