aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-06-29 18:12:58 -0400
committerJoey Hess <joey@kitenet.net>2011-06-29 18:12:58 -0400
commita18a62aa30fb80448793376a79fe2e567212f270 (patch)
treeb13ccb508f2402bf6256e990a3f2a68ed0b9f36e /IkiWiki/Plugin
parentadd72de71a922a7d7759c96931759e3680baaeae (diff)
downloadikiwiki-a18a62aa30fb80448793376a79fe2e567212f270.tar
ikiwiki-a18a62aa30fb80448793376a79fe2e567212f270.tar.gz
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.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/inline.pm8
1 files changed, 5 insertions, 3 deletions
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);