Permalink
Browse files

MDL-41672 Fix html2text processing of multiple occurrences of the sam…

…e URL
  • Loading branch information...
1 parent 12cead3 commit 11b4ad97f4b3a12b6aaf22223ce1834b3247003c @acorbier acorbier committed with mudrd8mz Oct 9, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/html2text.php
View
5 lib/html2text.php
@@ -580,9 +580,14 @@ function _build_link_list( $link, $display )
}
if (($index = array_search($url, $this->_link_list)) === false) {
+ // Add the link to the list.
$this->_link_list[] = $url;
$index = count($this->_link_list);
}
+ else {
+ // Use the index of the existing link in the list (we enumerate from 1, not from 0).
+ $index++;
+ }
return $display . ' [' . ($index) . ']';
}

0 comments on commit 11b4ad9

Please sign in to comment.