diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2021-07-10 18:51:55 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2021-07-10 18:51:55 +0200 |
commit | b7e7ff9a626dd5bd51ed291edd2de9075b69ffc8 (patch) | |
tree | 40b6454836e974415c960172b43af54462eba333 | |
parent | 2ee84c1570ed9c92c2badbb03294bda1bf6d1f16 (diff) | |
download | volse-hz-addons-b7e7ff9a626dd5bd51ed291edd2de9075b69ffc8.tar.gz volse-hz-addons-b7e7ff9a626dd5bd51ed291edd2de9075b69ffc8.tar.bz2 volse-hz-addons-b7e7ff9a626dd5bd51ed291edd2de9075b69ffc8.zip |
unshorturl: Only replace url if we could expand it
-rw-r--r-- | unshorturl/unshorturl.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unshorturl/unshorturl.php b/unshorturl/unshorturl.php index 6340e9a..e31268a 100644 --- a/unshorturl/unshorturl.php +++ b/unshorturl/unshorturl.php @@ -50,9 +50,11 @@ function unshorturl_prepare_body(&$body) { $num_matches = preg_match_all('/https?:\/\/bit\.ly\/\w+/', $body['html'], $matches); if ($num_matches > 0) { foreach ($matches as $links) { - error_log('unshorturl: Links found: ' . implode(', ', $links)); foreach($links as $l) { - $body['html'] = str_replace($l, unshorturl_get_long_url($l), $body['html']); + $longurl = unshorturl_get_long_url($l); + if ($longurl) { + $body['html'] = str_replace($l, $longurl, $body['html']); + } } } } |