Twitter Plugin Bugs

Found a bug? Tell us!!
Post Reply
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Twitter Plugin Bugs

Post by danst0 »

Hi,

I found some bugs in the Twitter plugin:
- When using the linktrimmer::create function unnecessary shorturls are created. Using lookup solves the problem
- for the tweetback lookup: the raw short url format cuts urls at 140 chars, and therefore leads to bad results. twitter can use the full url to search so I created another "reallyraw" shorturl and use it when looking for tweetbacks

This is the patch. I would love to see it in the official tree so I do not have to repatch with every new version.

Code: Select all

diff -rNu Downloads/serendipity_plugin_twitter/classes/UrlShortener.php Desktop/serendipity_plugin_twitter/classes/UrlShortener.php
--- Downloads/serendipity_plugin_twitter/classes/UrlShortener.php	2011-06-22 23:45:16.000000000 +0200
+++ Desktop/serendipity_plugin_twitter/classes/UrlShortener.php	2011-07-07 18:04:55.000000000 +0200
@@ -31,9 +31,9 @@
                     if (empty($lt_prefix)) $lt_prefix = '/s/';
 
                     if ($lt_domain == $serendipity['baseURL'])  {
-                        $shorturls['linktrimmer'] = $lt_domain . $lt_prefix .trim(serendipity_event_linktrimmer::create($url));
+                        $shorturls['linktrimmer'] = $lt_domain. $lt_prefix .trim(serendipity_event_linktrimmer::lookup($url));
                     } else {
-                        $shorturls['linktrimmer'] = $lt_domain . trim(serendipity_event_linktrimmer::create($url));
+                        $shorturls['linktrimmer'] = $lt_domain . trim(serendipity_event_linktrimmer::lookup($url));
                     }
                 }
                 break;
@@ -42,6 +42,9 @@
                     $shorturls['raw'] = $url;
                 }
                 break;
+            case 'reallyraw';
+                $shorturls['reallyraw'] = $url;
+                break;
             case 'tinyurl';
                 UrlShortener::shorten_via_tinyurl( $url, $shorturls );
                 break;
diff -rNu Downloads/serendipity_plugin_twitter/serendipity_event_twitter.php Desktop/serendipity_plugin_twitter/serendipity_event_twitter.php
--- Downloads/serendipity_plugin_twitter/serendipity_event_twitter.php	2011-06-12 12:31:54.000000000 +0200
+++ Desktop/serendipity_plugin_twitter/serendipity_event_twitter.php	2011-07-07 18:05:48.000000000 +0200
@@ -1685,7 +1685,7 @@
         }
 
         // Always look up 'raw'
-        UrlShortener::put_shorturl('raw', $article_url, $shorturls);
+        UrlShortener::put_shorturl('reallyraw', $article_url, $shorturls);
 
         TwitterPluginDbAccess::save_short_urls( $article_url, $shorturls, $loaded_shorturls );
         return $shorturls;
@@ -2044,4 +2044,4 @@
             $return = true;
         }
     }
-}
\ No newline at end of file
+}
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: Twitter Plugin Bugs

Post by blog.brockha.us »

danst0 wrote:for the tweetback lookup: the raw short url format cuts urls at 140 chars, and therefore leads to bad results.
What do you mean with that? Where are the "raw" URLs cut? But your reallyraw code made it into the repositories. I was wondering about that, when I did some changes on it yesterday.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
Post Reply