forked from GNUsocial/gnu-social
don't canonicalize people's text into URLs
This commit is contained in:
parent
166e4a4b58
commit
495c85544a
10
lib/util.php
10
lib/util.php
@ -500,17 +500,19 @@ function common_linkify($url) {
|
|||||||
// It comes in special'd, so we unspecial it before passing to the stringifying
|
// It comes in special'd, so we unspecial it before passing to the stringifying
|
||||||
// functions
|
// functions
|
||||||
$url = htmlspecialchars_decode($url);
|
$url = htmlspecialchars_decode($url);
|
||||||
$display = File_redirection::_canonUrl($url);
|
|
||||||
|
$canon = File_redirection::_canonUrl($url);
|
||||||
|
|
||||||
$longurl_data = File_redirection::where($url);
|
$longurl_data = File_redirection::where($url);
|
||||||
if (is_array($longurl_data)) {
|
if (is_array($longurl_data)) {
|
||||||
$longurl = $longurl_data['url'];
|
$longurl = $longurl_data['url'];
|
||||||
} elseif (is_string($longurl_data)) {
|
} elseif (is_string($longurl_data)) {
|
||||||
$longurl = $longurl_data;
|
$longurl = $longurl_data;
|
||||||
} else {
|
} else {
|
||||||
die('impossible to linkify');
|
throw new ServerException("Can't linkify url '$url'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$attrs = array('href' => $longurl, 'rel' => 'external');
|
$attrs = array('href' => $canon, 'rel' => 'external');
|
||||||
|
|
||||||
$is_attachment = false;
|
$is_attachment = false;
|
||||||
$attachment_id = null;
|
$attachment_id = null;
|
||||||
@ -564,7 +566,7 @@ function common_linkify($url) {
|
|||||||
$attrs['id'] = "attachment-{$attachment_id}";
|
$attrs['id'] = "attachment-{$attachment_id}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return XMLStringer::estring('a', $attrs, $display);
|
return XMLStringer::estring('a', $attrs, $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
function common_shorten_links($text)
|
function common_shorten_links($text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user