ashishkranjan / dabr

Automatically exported from code.google.com/p/dabr
0 stars 0 forks source link

fix long_url of digg.com #107

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What happened?
when calling long_url for digg.com, and the real long url is also on that
site, the function returns a relative path and could not be accessed correctly.

here is my small fix:

in function long_url, before returning the $url_long:

if (substr($url_long,0,7) !== "http://")
    {
        preg_match("/^(http:\/\/)?([^\/]+)/i", $shortURL, $matches);
        $host = $matches[2];
        $url_long="http://".$host."/".$url_long;
    }

Original issue reported on code.google.com by felixonm...@gmail.com on 29 Dec 2009 at 3:51

GoogleCodeExporter commented 9 years ago
updated

if (substr($url_long,0,4) !== "http"
    {
        preg_match("/^(http:\/\/)?([^\/]+)/i", $shortURL, $matches);
        $host = $matches[2];
        $url_long="http://".$host."/".$url_long;
    }

Original comment by felixonm...@gmail.com on 29 Dec 2009 at 6:36