Email addresses with multiple dots cause problem in link content

Created on 24 July 2023, over 1 year ago
Updated 26 July 2023, over 1 year ago

Problem/Motivation

When an email address has multiple dots in it, the SpamSpan filter replaces them with a "dot" in the frontend.
Even though the "Replace dots in email with text" checkbox is disabled and JS is activated.
It doesn't happen for the href value but for the content of the link.

Here is an example:

<p><a href="mailto:abc@test.de">abc@test.de</a></p>
<p><a href="mailto:abc@test.test.de">abc@test.test.de</a></p>
<p><a href="mailto:abc.def@test.de">abc.def@test.de</a></p>
<p><a href="mailto:abc.def@test.test.de">abc.def@test.test.de</a></p>
<p><a href="mailto:abcdef@test.de">abcdef@test.de</a></p>

The result:

If you deactivate Javascript the "@" and "." in the content always get replaced with "at" and "dot". Even when the "Replace dots in email with text" checkbox is disabled. It seems to be hardcoded in the SpamspanTrait.php function filterTagContents().

You can also see this if you change the [at] and [dot] to for example [AT1] and [DOT2]. Then the href value gets replaced with the right values and the content gets the hardcoded at and dot.

Proposed Solution

I'm not sure what the best solution for the problem with multiple dots is but the hardcoded "dot" and "at" should be replaced with the value of the "spamspan_at" and "spamspan_dot" settings.
And it should be checked if "spamspan_dot_enable" is true before replacing the dot in the content.

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇩🇪Germany lmoeni

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024