Moodle
  1. Moodle
  2. MDL-41672

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

    Details

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

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Alain Corbière added a comment -

            It is an other problem when the HTML links are identical.

            Show
            Alain Corbière added a comment - It is an other problem when the HTML links are identical.
            Hide
            David Mudrak added a comment -

            Thanks Alain Corbière for the patch! I just slightly improved the unit tests for this and processed the integration request.

            Show
            David Mudrak added a comment - Thanks Alain Corbière for the patch! I just slightly improved the unit tests for this and processed the integration request.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            Dan Poltawski added a comment -

            Integrated to master, 25 and 24 - thanks David/Alain

            Show
            Dan Poltawski added a comment - Integrated to master, 25 and 24 - thanks David/Alain
            Hide
            Dan Poltawski added a comment -

            (passed by cI)

            Show
            Dan Poltawski added a comment - (passed by cI)
            Hide
            Dan Poltawski added a comment -

            Hurrah! Thanks for your contribution - this fix is part of Moodle.

            Show
            Dan Poltawski added a comment - Hurrah! Thanks for your contribution - this fix is part of Moodle.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: