From 540c54539906c8bbf9b16c4cc0dd9365e221487d Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 26 Sep 2011 17:05:35 -0400 Subject: [PATCH] Don't replace URLs if 'shortened' version is longer, unless forced --- lib/util.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 75037625d0..99be56daeb 100644 --- a/lib/util.php +++ b/lib/util.php @@ -2163,7 +2163,11 @@ function common_shorten_url($long_url, User $user=null, $force = false) } else { $shortenedUrl = common_local_url('redirecturl', array('id' => $f->id)); - return $shortenedUrl; + if ((mb_strlen($shortenedUrl) < mb_strlen($long_url)) || $force) { + return $shortenedUrl; + } else { + return $long_url; + } } } else { return $long_url;