diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-29 18:12:58 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-29 18:12:58 -0400 |
commit | a18a62aa30fb80448793376a79fe2e567212f270 (patch) | |
tree | b13ccb508f2402bf6256e990a3f2a68ed0b9f36e | |
parent | add72de71a922a7d7759c96931759e3680baaeae (diff) | |
download | ikiwiki-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.
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 8 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn | 11 |
3 files changed, 17 insertions, 4 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); diff --git a/debian/changelog b/debian/changelog index b1fd95fdd..b25e9a596 100644 --- a/debian/changelog +++ b/debian/changelog @@ -27,6 +27,8 @@ ikiwiki (3.20110609) UNRELEASED; urgency=low fixes sorting comments by date. (smcv) * Run scan hooks for internal pages (preprocess hooks already run in scan mode) (smcv) + * inline: Handle obfuscated urls, such as the mailto urls generated by + markdown when forcing urls absolute. -- Joey Hess <joeyh@debian.org> Thu, 09 Jun 2011 10:06:44 -0400 diff --git a/doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn b/doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn index 9e4539334..8e694ff6c 100644 --- a/doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn +++ b/doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn @@ -17,4 +17,13 @@ for HTML, but for Atom and RSS. - +> This garbling is provably pointless. Proof: For $1000 I will take off my +> white hat, put on my black hat, and implement support for it in any +> spammer's email address extraction tool. Money will be donated to a +> spam-fighting organisation of my choice. +> +> So, in leu of money, it seems best to find a way to disable it in +> markdown. +> +> Anyway, I've fixed this, at the expense of additional total worldwide +> power usage, etc. --[[Joey]] |