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.
master
Joey Hess 2011-06-29 18:12:58 -04:00
parent add72de71a
commit a18a62aa30
3 changed files with 17 additions and 4 deletions

View 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);

2
debian/changelog vendored
View 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

View 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]]