]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1519564 followup - ensure there are never newlines in html attributes
authorDylan William Hardison <dylan@hardison.net>
Wed, 16 Jan 2019 21:39:54 +0000 (16:39 -0500)
committerGitHub <noreply@github.com>
Wed, 16 Jan 2019 21:39:54 +0000 (16:39 -0500)
Bugzilla/Markdown.pm

index 0693687012c96df13ddb6c90eaad5a205ff5ec32..6c7b06ecc0ce1c50abbe3243f43532b559da7afc 100644 (file)
@@ -51,6 +51,15 @@ sub render_html {
 
   if ($markdown =~ /^\s*$MARKDOWN_OFF\n/s) {
     my $text = $self->bugzilla_shorthand->( trim($markdown) );
+    my $dom = Mojo::DOM->new($text);
+    $dom->find('*')->each(sub {
+      my ($e) = @_;
+      my $attr = $e->attr;
+      foreach my $key (keys %$attr) {
+        $attr->{$key} =~ s/\s+/ /gs;
+      }
+    });
+    $text = $dom->to_string;
     my @p = split(/\n{2,}/, $text);
     my $html = join("\n", map { s/\n/<br>\n/gs; "<p>$_</p>\n" } @p );
     return $html;