Skip to content

Commit

Permalink
onclick attributes cause errors.So sanitize them.
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed Jan 22, 2012
1 parent 577b6db commit 8d4fec7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion webiblo.pl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use LWP::Simple;
use URI;
use HTML::TreeBuilder::XPath;
use HTML::Scrubber;
use Text::Xslate;
use Image::Resize;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 8d4fec7

Please sign in to comment.