summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-04-17 09:28:36 +0200
committerYorhel <git@yorhel.nl>2020-04-17 09:28:43 +0200
commit86c0a244fa47a301c43e0750cedff494b0d0ef64 (patch)
tree8e168e476c632ee86f066aa7a8e81dee38069af4 /lib
parent8f9ffbba7d5ea62d7b4cf7305ddf341aa5fe1ab7 (diff)
VN/Producers::Graph: Fix title/name escaping for Graphviz
Bit of trial and error what needs to be escaped and how, but this seems to work.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNWeb/Graph.pm2
-rw-r--r--lib/VNWeb/Producers/Graph.pm2
-rw-r--r--lib/VNWeb/VN/Graph.pm2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/VNWeb/Graph.pm b/lib/VNWeb/Graph.pm
index c7550fc5..1e826a70 100644
--- a/lib/VNWeb/Graph.pm
+++ b/lib/VNWeb/Graph.pm
@@ -64,7 +64,7 @@ sub dot2svg {
}
-sub val_escape { $_[0] =~ s/\\/\\\\/rg =~ s/"/\\"/rg =~ s/&/&amp;/rg }
+sub val_escape { $_[0] =~ s/&/&amp;/rg =~ s/\\/\\\\/rg =~ s/"/&quot;/rg =~ s/</&lt;/rg =~ s/>/&gt;/rg }
sub node_more {
diff --git a/lib/VNWeb/Producers/Graph.pm b/lib/VNWeb/Producers/Graph.pm
index e1fcaace..66f7e63c 100644
--- a/lib/VNWeb/Producers/Graph.pm
+++ b/lib/VNWeb/Producers/Graph.pm
@@ -30,7 +30,7 @@ TUWF::get qr{/$RE{pid}/rg}, sub {
my @lines;
my $params = $num == 15 ? '' : "?num=$num";
for my $n (sort { $a->{id} <=> $b->{id} } values %$nodes) {
- my $name = xml_escape shorten $n->{name}, 27;
+ my $name = val_escape shorten $n->{name}, 27;
my $tooltip = val_escape $n->{name};
my $nodeid = $n->{distance} == 0 ? 'id = "graph_current", ' : '';
push @lines,
diff --git a/lib/VNWeb/VN/Graph.pm b/lib/VNWeb/VN/Graph.pm
index 6254cf5c..45e8ea73 100644
--- a/lib/VNWeb/VN/Graph.pm
+++ b/lib/VNWeb/VN/Graph.pm
@@ -35,7 +35,7 @@ TUWF::get qr{/$RE{vid}/rg}, sub {
my @lines;
my $params = "?num=$num&unoff=$unoff";
for my $n (sort { $a->{id} <=> $b->{id} } values %$nodes) {
- my $title = xml_escape shorten $n->{title}, 27;
+ my $title = val_escape shorten $n->{title}, 27;
my $tooltip = val_escape $n->{title};
my $date = rdate $n->{c_released};
my $lang = $n->{lang}||'N/A';