Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-28059

Email link / clickable email not working in 2.03 forums

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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:

      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).

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            salvetore 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
            salvetore 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
            cfulton 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
            cfulton 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
            poltawski Dan Poltawski added a comment -

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

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

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

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

            Yes, this change was not intentional.

            Show
            skodak Petr Skoda added a comment - Yes, this change was not intentional.
            Hide
            stronk7 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
            stronk7 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
            andyjdavis Andrew Davis added a comment -

            mailto are now working as expected.

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

            Sent upstream and closing, many thanks!

            Show
            stronk7 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:
                  Fix Release Date:
                  10/Oct/11