Menu

#387 Email address cloaking is done for non-mailto links, even if feature is disabled

None
closed-works-for-me
nobody
None
2021-04-24
2020-05-01
No

I bumped into this while using the Pelican static site generator; see the issue report there).

It seems if i have an @ character in a filename, it will be converted to @ even if email cloaking is disabled.

As a minimal example, i use this configuration:

[html writers]
cloak_email_addresses=yes

and this example .rst file:

My `public PGP key <./gergely@polonkai>`_

The result is (irrelevant lines omitted):

<p>My <a class="reference external" href="./gergely&#64;polonkai">public PGP key</a></p>

In Pelican’s case this results in a warning, stating that my file is not available.

Is this a bug? If not, is there a way to circumvent it?

Discussion

  • David Goodger

    David Goodger - 2020-05-01

    This behavior is as intended, not a bug. It was intended to help thwart email harvesters, separately from email cloaking. I don't if it's useful for that or not. The behavior could be removed for the "@" character specifically if it's really causing an issue (but see below). The code for it is here: docutils.writers._html_base.HTMLTranslator.encode, using the HTMLTranslator.special_characters lookup table.

    Try your generated HTML and see: it should work fine. At least, it works fine with vanilla Docutils. Clicking the link should retrieve the file without issue. Your browser turns "&#64;" back into a "@" automatically.

    I guess that Pelican is not doing the entity-to-character conversion before checking for file availability before complaining. Try a file with a double-quote (") or a less-than (<) character in its name. Those characters absolutely have to be escaped in HTML. If Pelican complains with those, it's a deficiency in Pelican.

     

    Last edit: David Goodger 2020-05-01
  • David Goodger

    David Goodger - 2020-05-01
    • status: open --> pending-works-for-me
     
  • Günter Milde

    Günter Milde - 2021-04-24
    • status: pending-works-for-me --> closed-works-for-me
     

Log in to post a comment.