Hack for twitter cards with quote chars. Needs a better fix.
authorRyan C. Gordon <icculus@icculus.org>
Mon, 25 Apr 2016 09:18:11 -0400
changeset 87 6f646cf3a0df
parent 86 afdfeb6893d6
child 88 479571afa3c7
Hack for twitter cards with quote chars. Needs a better fix.
IcculusFinger_daemon.pl
--- a/IcculusFinger_daemon.pl	Tue Mar 22 12:47:54 2016 -0400
+++ b/IcculusFinger_daemon.pl	Mon Apr 25 09:18:11 2016 -0400
@@ -683,9 +683,14 @@
     if (defined $metadata{'twitter'}) {
         my $uname = $metadata{'twitter'};
         my $summary = $metadata{'summary'};
+        my $titlestr = $title;
+        # !!! FIXME: we need a proper HTML encoder.
+        $uname = s/'/\\'/g;
+        $titlestr = s/'/\\'/g;
+        $summary = s/'/\\'/g;
         $twitter .= "<meta name='twitter:card' content='summary' />\n";
         $twitter .= "<meta name='twitter:site' content='\@$uname' />\n";
-        $twitter .= "<meta name='twitter:title' content='$title' />\n";
+        $twitter .= "<meta name='twitter:title' content='$titlestr' />\n";
         $twitter .= "<meta name='twitter:description' content='$summary' />\n";
     }