From a18a62aa30fb80448793376a79fe2e567212f270 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 29 Jun 2011 18:12:58 -0400 Subject: inline: Handle obfuscated urls, such as the mailto urls generated by markdown when forcing urls absolute. That took me 5 minutes. If anyone thinks obfuscated email urls stops, or even slows down spammers, think again. --- IkiWiki/Plugin/inline.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index ffdf397f1..77634066b 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -564,13 +564,15 @@ sub absolute_urls ($$) { next unless $v_offset; # 0 v_offset means no value my $v = substr($text, $v_offset, $v_len); $v =~ s/^([\'\"])(.*)\1$/$2/; - if ($v=~/^#/) { + eval q{use HTML::Entities}; + my $dv = decode_entities($v); + if ($dv=~/^#/) { $v=$baseurl.$v; # anchor } - elsif ($v=~/^(?!\w+:)[^\/]/) { + elsif ($dv=~/^(?!\w+:)[^\/]/) { $v=$url.$v; # relative url } - elsif ($v=~/^\//) { + elsif ($dv=~/^\//) { if (! defined $urltop) { # what is the non path part of the url? my $top_uri = URI->new($url); -- cgit v1.2.3