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

Identical HTML links not enumerated correctly in forum post copies sent to email

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.6, 2.5, 2.5.2
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Libraries, Unit tests
    • Labels:
      None

      Description

      When html content contains identical links, there is a problem on the enumerated links in the convert html to text.
      Steps to reproduce :
      1. Type this text in html format (a message forum by example).

      <p>There are links on <a href="http://www.google.fr">google</a>, <a href="http://www.google.fr">google</a> and <a href="http://www.univ-lemans.fr">univ-lemans</a>

      2. Convert with html2test function (/lib/html2text.php).

        There are links on google [1], google [0] and univ-lemans [2]
         Links:
         ------
         [1] http://www.google.fr [2] http://www.univ-lemans.fr
      

      This message has this bug, in the first line, the second link should be indexed 1 and not 0.

      To reproduce these steps in Unit test (after the line 80 in https://github.com/moodle/moodle/blob/master/lib/tests/html2text_test.php).

      $this->assertEquals("There are links on google [1], google [1] and univ-lemans [2]\n\nLinks:\n------\n[1] http://www.google.fr\n[2] http://www.univ-lemans.fr\n",
                   html_to_text('<p>There are links on <a href="http://www.google.fr">google</a>, <a href="http://www.google.fr">google</a> and <a href="http://www.univ-lemans.fr">univ-lemans</a>',75,true));

      One solution is to add these two lines (in _build_link_list function after the line 586 in https://github.com/moodle/moodle/blob/master/lib/html2text.php).

        else
           $index++ ;
      

      Thanks,

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mudrd8mz David Mudrák (@mudrd8mz)
              Reporter:
              acorbi Alain Corbière
              Integrator:
              Dan Poltawski
              Tester:
              Rajesh Taneja
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Nov/13