Moodle
  1. Moodle
  2. MDL-28059

Email link / clickable email not working in 2.03 forums

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1.1, 2.2
    • Fix Version/s: 2.0.5, 2.1.2
    • Component/s: Forum
    • Labels:
    • Environment:
      PC and Mac
    • Testing Instructions:
      Hide

      Create forum post:
      1. Type text (e.g. email@example.com).
      2. Select the text
      3. Click the link icon in the WYSIWYG editor
      4. Under Link URL type: email@example.com.
      5. clicked insert.
      6. Moodle creates the link.
      7. Click submit
      8. View your post
      expected result:
      The mailto link is retailed
      actual result:
      The mailto is stripped from the html

      Show
      Create forum post: 1. Type text (e.g. email@example.com). 2. Select the text 3. Click the link icon in the WYSIWYG editor 4. Under Link URL type: email@example.com . 5. clicked insert. 6. Moodle creates the link. 7. Click submit 8. View your post expected result: The mailto link is retailed actual result: The mailto is stripped from the html
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      17739

      Description

      When a news item / forum post is added and it includes a link to an email address (email@example.com), the address is highlighted and underlined like a link but the link is not "clickable".

      I have tried:

      Process 1-Manual HTML Coding:

      1. I typed my text (e.g. email@example.com)
      2. I click the HTML icon.
      3. I added this code sequence: <a href= m a i l t o : email @ example.com>email @ example.com</a>
      4. I clicked Update
      5. Moodle created the link.

      Process 2:

      1. Type text (e.g. email@example.com).
      2. Select the text
      3. Click the link icon in the WYSIWYG editor
      4. Under Link URL I typed: email@example.com.
      5. I clicked insert.
      6. Moodle created the link.

      After both processes Moodle created the link. Once the post was posted to the forum, Moodle stripped the formatting so that it read: <a>email@example.com</a>. When looking at the post, Moodle makes the email appear in blue (as though it were a link), but it you cannot click on the link (or at least it does not take you anywhere).

        Activity

        Hide
        Michael de Raadt added a comment -

        I can replicate this. A link with a mailto: in the href gets converted from...

        <p>Message including a mailto link: <a href="mailto:michaeld@moodle.com">michaeld@moodle.com</a></p>

        ...to...

        <p>Message including a mailto link: <a>michaeld@moodle.com</a></p>

        This only seems to happen with Forums.

        I'm not sure if this is deliberate.

        Show
        Michael de Raadt added a comment - I can replicate this. A link with a mailto: in the href gets converted from... <p>Message including a mailto link: <a href= "mailto:michaeld@moodle.com" >michaeld@moodle.com</a></p> ...to... <p>Message including a mailto link: <a>michaeld@moodle.com</a></p> This only seems to happen with Forums. I'm not sure if this is deliberate.
        Hide
        Charles Fulton added a comment - - edited

        Confirmed in 2.1 as well. At least for editing a post there's a function call at line 278 (Moodle 2.1) to trusttext_pre_edit, which in turn invokes purify_html. That's almost certainly where it's taking place. Other hyperlinks are fine. I think this is a bug/unwanted feature: if hyperlinks are allowed, an email address isn't any more dangerous/undesirable than a vanilla link.

        Adding "mailto" to the list of URI.AllowedSchemes in the purify_html() function fixes the problem, but lots of stuff calls that function through clean_text().

        Show
        Charles Fulton added a comment - - edited Confirmed in 2.1 as well. At least for editing a post there's a function call at line 278 (Moodle 2.1) to trusttext_pre_edit, which in turn invokes purify_html. That's almost certainly where it's taking place. Other hyperlinks are fine. I think this is a bug/unwanted feature: if hyperlinks are allowed, an email address isn't any more dangerous/undesirable than a vanilla link. Adding "mailto" to the list of URI.AllowedSchemes in the purify_html() function fixes the problem, but lots of stuff calls that function through clean_text().
        Hide
        Dan Poltawski added a comment -

        Integrators: this patch can be cherry picked to 21_STABLE and 20_STABLE

        Show
        Dan Poltawski added a comment - Integrators: this patch can be cherry picked to 21_STABLE and 20_STABLE
        Hide
        Dan Poltawski added a comment -

        (I don't believe there is a justification to delibretely strip these from the HTML)

        Show
        Dan Poltawski added a comment - (I don't believe there is a justification to delibretely strip these from the HTML)
        Hide
        Petr Škoda added a comment -

        Yes, this change was not intentional.

        Show
        Petr Škoda added a comment - Yes, this change was not intentional.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Integrated into master and backported to 20_STABLE and 21_STABLE as suggested, thanks!

        Offtopic, was funny to see we are supporting teamspeak, lol.

        Show
        Eloy Lafuente (stronk7) added a comment - Integrated into master and backported to 20_STABLE and 21_STABLE as suggested, thanks! Offtopic, was funny to see we are supporting teamspeak, lol.
        Hide
        Andrew Davis added a comment -

        mailto are now working as expected.

        Show
        Andrew Davis added a comment - mailto are now working as expected.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Sent upstream and closing, many thanks!

        Show
        Eloy Lafuente (stronk7) added a comment - Sent upstream and closing, many thanks!

          People

          • Votes:
            20 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: