]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't replace URLs if 'shortened' version is longer, unless forced
authorEvan Prodromou <evan@status.net>
Mon, 26 Sep 2011 21:05:35 +0000 (17:05 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 26 Sep 2011 21:05:35 +0000 (17:05 -0400)
lib/util.php

index 75037625d095e808125580d8d893d1c0e8c65a62..99be56daeb3981a211abf683411975cf0a36e00b 100644 (file)
@@ -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;