inline: Handle obfuscated urls, such as the mailto urls generated by markdown when...
authorJoey Hess <joey@kitenet.net>
Wed, 29 Jun 2011 22:12:58 +0000 (18:12 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 29 Jun 2011 22:12:58 +0000 (18:12 -0400)
That took me 5 minutes. If anyone thinks obfuscated email urls stops, or
even slows down spammers, think again.

IkiWiki/Plugin/inline.pm
debian/changelog
doc/bugs/mailto:_links_not_properly_generated_in_rssatom_feeds.mdwn

index ffdf397f1f337af6cfcb6435f8aaf35fcc63faf7..77634066b795c94151c609b1ec7c8dd063da672d 100644 (file)
@@ -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);
index b1fd95fdd7dc3edb5e578fea23aa14957f51f6f6..b25e9a596651fae7215d4a2005dc377cf6dfbd69 100644 (file)
@@ -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
 
index 9e4539334d8776b00a7a47fce991352cab85f838..8e694ff6c6b5a98ebef932380688f50a2d4fd4f0 100644 (file)
@@ -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]]