Ensure that shortened URLs haven't accumulated whitespace when fetched by a plugin. Some shorteners have ended up inserting extra newlines when the string gets extracted from tidied HTML.

This commit is contained in:
Brion Vibber 2010-02-25 10:30:37 -08:00
parent 4a71753f20
commit 39a8e9d8e6

View File

@ -1606,6 +1606,7 @@ function common_database_tablename($tablename)
*/ */
function common_shorten_url($long_url) function common_shorten_url($long_url)
{ {
$long_url = trim($long_url);
$user = common_current_user(); $user = common_current_user();
if (empty($user)) { if (empty($user)) {
// common current user does not find a user when called from the XMPP daemon // common current user does not find a user when called from the XMPP daemon
@ -1620,7 +1621,7 @@ function common_shorten_url($long_url)
return $long_url; return $long_url;
}else{ }else{
//URL was shortened, so return the result //URL was shortened, so return the result
return $shortenedUrl; return trim($shortenedUrl);
} }
} }