From a18a62aa30fb80448793376a79fe2e567212f270 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 29 Jun 2011 18:12:58 -0400 Subject: [PATCH] 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 +++++--- debian/changelog | 2 ++ ...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 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]] -- 2.32.0.93.g670b81a890