diff --git a/lib/html2text.php b/lib/html2text.php index b78b0ae1b9b..89c9e69bf72 100644 --- a/lib/html2text.php +++ b/lib/html2text.php @@ -580,9 +580,14 @@ class html2text } 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) . ']'; }