Fix ampersand encoding in message URLs

Resolves #235.
This commit is contained in:
Trevor Slocum 2022-03-31 10:45:48 -07:00
parent 2805934548
commit 93c91aec20
2 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,13 @@ function cleanString($string) {
return str_replace($search, $replace, $string);
}
function cleanQuotes($string) {
$search = array("'", "\"");
$replace = array("'", """);
return str_replace($search, $replace, $string);
}
function plural($count, $singular, $plural) {
if ($plural == 's') {
$plural = $singular . $plural;

View File

@ -95,8 +95,8 @@ function _makeLinksClickable($matches) {
if (!isset($matches[1])) {
return '';
}
$url = str_replace('&', '&', htmlspecialchars($matches[1], ENT_QUOTES));
$text = htmlentities($matches[1], ENT_QUOTES);
$url = cleanQuotes($matches[1]);
$text = $matches[1];
return '<a href="' . $url . '" target="_blank">' . $text . '</a>';
}