Skip to content
Browse files

onclick attributes cause errors.So sanitize them.

  • Loading branch information...
1 parent 577b6db commit 8d4fec7f0d02207e87dd09a2b0c013a79a37ddd3 @mizzy mizzy committed Jan 22, 2012
Showing with 17 additions and 1 deletion.
  1. +17 −1 webiblo.pl
View
18 webiblo.pl
@@ -6,6 +6,7 @@
use LWP::Simple;
use URI;
use HTML::TreeBuilder::XPath;
+use HTML::Scrubber;
use Text::Xslate;
use Image::Resize;
@@ -154,8 +155,23 @@ sub get_content {
$image->attr('src', $file);
}
+ my @default = (
+ 1,
+ {
+ '*' => 1,
+ 'onclick' => 0,
+ },
+ );
+
+ my $scrubber = HTML::Scrubber->new(
+ default => \@default,
+ );
+
+ my $content = $scrubber->scrub($tree->as_XML_indented);
+ $tree->delete;
+
open my $out, '>', "out/$file" or die $!;
- print $out $tree->as_XML;
+ print $out $content;
close $out;
}

0 comments on commit 8d4fec7

Please sign in to comment.
Something went wrong with that request. Please try again.